home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / tolleuhr / tolleuhr.s next >
Text File  |  1980-01-03  |  73KB  |  3,376 lines

  1. ***************************************************************************
  2.  
  3. ; inspired from 'TolleUhr' by Matthias Fleischer - translated to assembler
  4. ; (gcc is good - I am better ;)
  5.  
  6. ; uhr v0.1 - 24/02/94 by Gunther Nikl - project started
  7. ; uhr v1.2 - 07/03/94 by Gunther Nikl - newlookmenus, localized, bugfixed
  8. ;            24/08/94 by Gunther Nikl - several minor improvements
  9. ;            12/12/94 by Gunther Nikl - reduced stack usage, tweaked
  10. ;            27/02/95 by Gunther Nikl - savePrefs() rewritten, bugfixed
  11. ; uhr v1.3   07/03/95 by Gunther Nikl - alarmSet() fixed (didn't set st/mi)
  12. ;            05/05/95 by Gunther Nikl - optional background image added
  13. ;            18/05/95 by Gunther Nikl - added 'NOREMAP' switch
  14.  
  15. ***************************************************************************
  16.  
  17. ; include stuff
  18.  
  19.         include    exec/types.i
  20.         include    lvo30/dos_lib.i
  21.         include    lvo30/exec_lib.i
  22.         include    lvo30/icon_lib.i
  23.         include    lvo30/locale_lib.i
  24.         include    lvo30/gadtools_lib.i
  25.         include    lvo30/graphics_lib.i
  26.         include    lvo30/intuition_lib.i
  27.         include    lvo30/datatypes_lib.i
  28.  
  29. ; specific define(s)
  30.  
  31. _LVOBeginIO    equ    -30            ; for audio
  32. _LVOGetSysTime    equ    -66            ; for timer
  33.  
  34. ArgCount    equ    25            ; entries
  35.  
  36. ; macro stuff
  37.  
  38. CALL        MACRO
  39.         move.l    \2,a6
  40.         jsr    _LVO\1(a6)
  41.         ENDM
  42.  
  43. RECALL        MACRO
  44.         jsr    _LVO\1(a6)
  45.         ENDM
  46.  
  47. MITEM        macro
  48.         IFEQ    NARG-5
  49. ItemCount    set    \5
  50.         ENDC
  51.         dc.b    \1,\2,\3,\4
  52. ItemCount    set    ItemCount+1
  53.         endm
  54.  
  55. WINIT        macro                ; idcmp,wintitle,gadgetcnt
  56.         dc.w    \1
  57.         dc.b    \2,\3
  58.         endm
  59.  
  60. GITEM        macro                ; left,top,width,height,gtext,kind
  61.         dc.b    \1,\2,\3,\4,\5,\6
  62.         endm
  63.  
  64. ADDCMD        macro                ; Table,Function,[Number]
  65.         IFEQ    NARG-3
  66. \1Num        set    \3
  67.         ENDC
  68.         dc.w    \1\2-\1Tab
  69. \1Num        set    \1Num+1
  70.         endm
  71.  
  72. ADDLOC        macro
  73.         IFEQ    NARG-2
  74. LocCount    set    \2
  75.         ENDC
  76.         dc.w    m_\1-LocaleTab
  77. \1        equ    LocCount
  78. LocCount    set    \1+1
  79.         endm
  80.  
  81. ; global stuff
  82.  
  83.     STRUCTURE Globals,0
  84.  
  85.      ULONG    SysBase
  86.      ULONG    WbMsg
  87.      ULONG    DosBase
  88.      ULONG    IconBase
  89.      ULONG    IntBase
  90.      ULONG    GfxBase
  91.      ULONG    GadsBase
  92.      ULONG    DtBase
  93.      ULONG    LocBase
  94.      ULONG    Catalog
  95.      ULONG    OurTask
  96.      ULONG    OldLock
  97.      ULONG    OldPri
  98.  
  99.      ULONG    WinPort
  100.  
  101.      ULONG    TimerPort
  102.      ULONG    TimerIO
  103.      ULONG    AudioPort
  104.      STRUCT    AudioIO,8
  105.      ULONG    WaveForm
  106.  
  107.      ULONG    NameBuf
  108.  
  109.      ULONG    VisualInfo
  110.      ULONG    Menus
  111.      ULONG    WinPtr
  112.      ULONG    RPort1
  113.  
  114.      STRUCT    ColWin,8
  115.      STRUCT    AlmWin,8
  116.      ULONG    AboutReq
  117.  
  118.      ULONG    Links
  119.      ULONG    Oben
  120.      ULONG    Breite
  121.      ULONG    Hoehe
  122.      ULONG    BoLeft
  123.      ULONG    BoTop
  124.      ULONG    Breit2
  125.      ULONG    Hoehe2
  126.      ULONG    ReDrawx1
  127.      ULONG    ReDrawy1
  128.      ULONG    ReDrawx2
  129.      ULONG    ReDrawy2
  130.      ULONG    xMask
  131.      ULONG    yMask
  132.      ULONG    Buf
  133.      ULONG    PlayTune
  134.      ULONG    color
  135.  
  136.      UWORD    std
  137.      UWORD    min
  138.      UWORD    sec
  139.      UWORD    alstd
  140.      UWORD    almin
  141.      UWORD    st
  142.      UWORD    mi
  143.      UWORD    xOffset
  144.      UWORD    yOffset
  145.      UWORD    GadSize
  146.  
  147.      UBYTE    EndAll
  148.      UBYTE    Active
  149.      UBYTE    TimerOpen
  150.      UBYTE    TimerSent
  151.      UBYTE    AudioOpen
  152.      STRUCT    AudioSent,2
  153.      UBYTE    SoundOn
  154.      UBYTE    sekunden
  155.      UBYTE    oval
  156.      UBYTE    schatten
  157.      UBYTE    hires
  158.      UBYTE    interlace
  159.      UBYTE    smarthour
  160.      UBYTE    zeigen
  161.      UBYTE    zeigertyp
  162.      UBYTE    zeigerbreite
  163.      UBYTE    rahmenanz
  164.      UBYTE    chime
  165.      UBYTE    xDouble
  166.      UBYTE    yDouble
  167.      UBYTE    alarm
  168.      UBYTE    reqnr
  169.      UBYTE    filter
  170.      UBYTE    closegad
  171.      UBYTE    useimage
  172.      UBYTE    changeddir
  173.      UBYTE    changedpri
  174.      UBYTE    noremap
  175.      STRUCT    pad,3
  176.  
  177.      STRUCT    BFInfo,4*4
  178.      STRUCT    PrgArg,2*4
  179.      STRUCT    TextAttr,8
  180.      STRUCT    Pens,16
  181.      STRUCT    Must,4
  182.      STRUCT    NewWinBuf,48
  183.      STRUCT    GadgetBuf,44*4
  184.      STRUCT    RPort2,100
  185.      STRUCT    BitMap1,40
  186.      STRUCT    TempRas,8
  187.      STRUCT    AreaInf,24
  188.      STRUCT    Table,28
  189.      STRUCT    Muster,32
  190.      STRUCT    NewGad,32
  191.      STRUCT    EasyBuf,20
  192.  
  193.     LABEL gb_SIZEOF
  194.  
  195.     STRUCTURE BackFillInfo,BFInfo
  196.  
  197.      ULONG    ImgName
  198.      ULONG    ImgObject
  199.      ULONG    ImgBitMapHeader
  200.      ULONG    ImgBitMap
  201.  
  202.     LABEL bfi_SIZEOF
  203.  
  204. PubScreen    equ    NewWinBuf+30
  205.  
  206. bp        equr    a4            ; base register
  207.  
  208. ***************************************************************************
  209.  
  210.         SECTION start,CODE
  211.  
  212. start        move.w    #(gb_SIZEOF>>2)-1,d0
  213. 1$        clr.l    -(sp)            ; clear local var area
  214.         dbra    d0,1$
  215.         move.l    sp,bp
  216.         move.l    4,a6
  217.         move.l    a6,SysBase(bp)        ; cache ExecBase
  218.         suba.l    a1,a1
  219.         RECALL    FindTask        ; use system function ..
  220.         move.l    d0,a2
  221.         move.l    a2,OurTask(bp)        ; cache task ptr
  222.         tst.l    172(a2)
  223.         bne.s    fromCLI
  224. fromWB        lea    92(a2),a0        ; get wbmsg
  225.         RECALL    WaitPort
  226.         lea    92(a2),a0
  227.         RECALL    GetMsg
  228.         move.l    d0,WbMsg(bp)
  229. fromCLI        bsr    main            ; call main
  230.         move.l    WbMsg(bp),d2
  231.         beq.s    1$
  232.         RECALL    Forbid
  233.         move.l    d2,a1
  234.         RECALL    ReplyMsg        ; reply wbsmg
  235. 1$        moveq    #0,d0
  236.         lea    gb_SIZEOF(bp),sp
  237.         rts
  238.  
  239. ***************************************************************************
  240.  
  241. OpenMainWin    lea    NewWinBuf(bp),a0    ; init & open main window
  242.         move.w    Links+2(bp),d0
  243.         swap    d0
  244.         move.w    Oben+2(bp),d0
  245.         move.w    Breite+2(bp),d1
  246.         swap    d1
  247.         move.w    Hoehe+2(bp),d1
  248.         movem.l    d0/d1,0(a0)        ; size
  249.         move.b    #1,9(a0)
  250.         move.l    #$c0306,d3        ; idcmp
  251.         move.l    #$200840,14(a0)        ; flags
  252.         lea    GadgetBuf(bp),a1
  253.         move.l    a1,18(a0)        ; gadgets
  254.         move.l    #10<<16+10,38(a0)
  255.         moveq    #-1,d0
  256.         move.l    d0,42(a0)
  257.         move.w    #2,46(a0)        ; PUBLICSCREEN
  258.         lea    maintags(pc),a1
  259.         bsr    OpenWindow
  260.         beq.s    1$            ; error !
  261.         move.l    d2,WinPtr(bp)
  262.         move.l    d2,a0
  263.         move.l    50(a0),RPort1(bp)
  264.         suba.l    a1,a1
  265.         lea    ProgName(pc),a2        ; new screen title
  266.         RECALL    SetWindowTitles
  267.         move.l    d2,a0
  268.         move.l    Menus(bp),a1
  269.         RECALL    SetMenuStrip
  270.         move.l    #$f901,d0        ; 'Use Image' MenuItem
  271.         tst.l    ImgBitMap(bp)
  272.         beq.s    3$
  273.         tst.b    useimage(bp)
  274.         beq.s    2$
  275.         move.w    #$ffe3,d0        ; 'Pattern' Menu
  276. 3$        move.l    d2,a0
  277.         RECALL    OffMenu            ; disable Menu[Item]
  278. 2$        moveq    #0,d0
  279.         move.b    Pens+0(bp),d0
  280.         move.l    RPort1(bp),a1
  281.         CALL    SetAPen,GfxBase(bp)
  282.         bsr    NewSize2        ; update gfx stuff
  283.         beq.s    1$
  284.         bsr    NextTick
  285.         bsr    Rahmen
  286.         bsr    ZifferBlatt
  287.         bsr    Zeichnen
  288. 1$        rts
  289.  
  290. ***************************************************************************
  291.  
  292. LoadImage    move.l    DtBase(bp),d0
  293.         beq.s    1$            ; no datatypes !
  294.         move.l    d0,a6
  295.         move.l    ImgName(bp),d0
  296.         beq.s    1$
  297.         move.l    sp,a3            ; save sp
  298.         pea    dttags(pc)
  299.         moveq    #2,d1
  300.         move.l    d1,-(sp)        ; TAG_MORE,dttags
  301.         tst.b    noremap(bp)
  302.         seq    d1
  303.         move.l    d1,-(sp)
  304.         pea    $800010D3        ; PDTA_Remap
  305.         move.l    PubScreen(bp),-(sp)
  306.         pea    $800010d4        ; PDTA_Screen
  307.         move.l    sp,a0
  308.         RECALL    NewDTObjectA
  309.         move.l    d0,d2
  310.         move.l    d2,ImgObject(bp)
  311.         beq.s    2$            ; no image !
  312.         move.l    d2,a2
  313.         pea    1
  314.         clr.l    -(sp)
  315.         pea    $602            ; DTM_PROCLAYOUT
  316.         move.l    sp,a1
  317.         move.l    -4(a2),a0
  318.         bsr.s    _DoMethod
  319.         tst.l    d0            ; ok ?
  320.         beq.s    2$
  321.         clr.l    -(sp)            ; TAG_DONE
  322.         pea    ImgBitMap(bp)
  323.         pea    $800010d7        ; PDTA_DestBitmap
  324.         pea    ImgBitMapHeader(bp)
  325.         pea    $800010c9        ; PDTA_BitMapHeader
  326.         move.l    sp,a2
  327.         move.l    d2,a0
  328.         RECALL    GetDTAttrsA
  329. 2$        move.l    a3,sp            ; restore sp
  330. 1$        rts
  331.  
  332. _DoMethod    move.l    8(a0),-(sp)        ; invoke dispatcher
  333.         rts
  334.  
  335. ***************************************************************************
  336.  
  337. InitClock    bsr    LoadImage        ; load background image
  338.         bsr    SetPattern        ; set new pattern
  339.         lea    TextAttr(bp),a0        ; init font struct
  340.         lea    TopazName(pc),a1
  341.         move.l    a1,(a0)+
  342.         move.l    #$80001,(a0)
  343.         lea    GadgetBuf(bp),a1    ; init gfx stuff
  344.         lea    GadgetList(pc),a0
  345.         moveq    #1,d0
  346.         moveq    #3,d1
  347. 6$        move.w    d0,8(a1)        ; width
  348.         move.w    d0,10(a1)        ; height
  349.         move.b    (a0)+,13(a1)        ; flags
  350.         move.b    d0,15(a1)        ; activation
  351.         move.b    (a0)+,17(a1)        ; type
  352.         lea    44(a1),a1
  353.         move.l    a1,-44(a1)
  354.         dbra    d1,6$
  355.         clr.l    -44(a1)            ; clear last ptr
  356.         move.w    #(20/4)*(ItemCount+1)-1,d1
  357. 5$        clr.l    -(sp)
  358.         dbra    d1,5$
  359.         lea    MenuList(pc),a2
  360.         move.l    sp,a3
  361.         moveq    #ItemCount-1,d2
  362. 4$        move.b    (a2)+,0(a3)        ; type
  363.         move.b    (a2)+,d0
  364.         ext.w    d0
  365.         ext.l    d0
  366.         bmi.s    3$
  367.         bsr    GetLocStr        ; get localized string
  368. 3$        move.l    d0,2(a3)
  369.         move.b    (a2)+,11(a3)        ; flags
  370.         moveq    #0,d0
  371.         move.b    (a2)+,d0        ; mutual exclude
  372.         bpl.s    2$
  373.         andi.w    #$7f,d0
  374.         lsl.w    #5,d0
  375. 2$        move.l    d0,12(a3)
  376.         lea    20(a3),a3        ; next menu
  377.         dbra    d2,4$
  378.         moveq    #AboutKey,d0        ; command keys for project menu
  379.         bsr    GetLocStr
  380.         move.l    d0,1*20+6(sp)
  381.         moveq    #QuitKey,d0
  382.         bsr    GetLocStr
  383.         move.l    d0,2*20+6(sp)
  384.         moveq    #SaveKey,d0
  385.         bsr    GetLocStr
  386.         move.l    d0,43*20+6(sp)
  387.         move.l    PubScreen(bp),a0
  388.         suba.l    a1,a1
  389.         CALL    GetVisualInfoA,GadsBase(bp)
  390.         move.l    d0,VisualInfo(bp)
  391.         beq    0$
  392.         moveq    #20,d3            ; prepare menus
  393.         moveq    #$100>>8,d1
  394.         move.l    sp,a0
  395.         tst.b    sekunden(bp)
  396.         sne    d0
  397.         and.b    d1,d0
  398.         or.b    d0,4*20+10(a0)
  399.         tst.b    oval(bp)
  400.         sne    d0
  401.         and.b    d1,d0
  402.         or.b    d0,5*20+10(a0)
  403.         moveq    #7,d2
  404.         add.b    zeigen(bp),d2        ; what to show
  405.         mulu    d3,d2
  406.         or.b    d1,10(a0,d2.w)
  407.         moveq    #13,d2
  408.         add.b    zeigertyp(bp),d2    ; handtype
  409.         mulu    d3,d2
  410.         or.b    d1,10(a0,d2.w)
  411.         moveq    #18,d2
  412.         add.b    zeigerbreite(bp),d2    ; handwidth
  413.         mulu    d3,d2
  414.         or.b    d1,10(a0,d2.w)
  415.         tst.b    schatten(bp)
  416.         sne    d0
  417.         and.b    d1,d0
  418.         or.b    d0,23*20+10(a0)
  419.         moveq    #25,d2
  420.         add.b    rahmenanz(bp),d2    ; bordercnt
  421.         mulu    d3,d2
  422.         or.b    d1,10(a0,d2.w)
  423.         tst.b    hires(bp)
  424.         sne    d0
  425.         and.b    d1,d0
  426.         or.b    d0,29*20+10(a0)
  427.         tst.b    interlace(bp)
  428.         sne    d0
  429.         and.b    d1,d0
  430.         or.b    d0,30*20+10(a0)
  431.         moveq    #32,d2
  432.         add.b    chime(bp),d2
  433.         mulu    d3,d2
  434.         or.b    d1,10(a0,d2.w)
  435.         tst.b    smarthour(bp)
  436.         sne    d0
  437.         and.b    d1,d0
  438.         or.b    d0,36*20+10(a0)
  439.         tst.l    ImgBitMap(bp)
  440.         sne    d0
  441.         and.b    d1,d0
  442.         tst.b    useimage(bp)
  443.         sne    d2
  444.         and.b    d2,d0
  445.         or.b    d0,40*20+10(a0)
  446.         tst.b    closegad(bp)
  447.         sne    d0
  448.         and.b    d1,d0
  449.         or.b    d0,41*20+10(a0)
  450.         suba.l    a1,a1
  451.         RECALL    CreateMenusA
  452.         move.l    d0,Menus(bp)
  453. 0$        lea    20*(ItemCount+1)(sp),sp
  454.         beq.s    1$            ; no menus !
  455.         move.l    d0,a0
  456.         move.l    VisualInfo(bp),a1
  457.         lea    MenuTag(pc),a2
  458.         RECALL    LayoutMenusA
  459.         tst.l    d0
  460.         beq.s    1$            ; error !
  461.         bsr    OpenMainWin
  462. 1$        rts
  463.  
  464. ***************************************************************************
  465.  
  466. OpenDevs    CALL    CreateMsgPort,SysBase(bp) ; init device stuff
  467.         move.l    d0,WinPort(bp)
  468.         beq.s    OpenDevs-2
  469.         RECALL    CreateMsgPort
  470.         move.l    d0,TimerPort(bp)
  471.         beq.s    1$
  472.         move.l    d0,a0
  473.         moveq    #40,d0
  474.         RECALL    CreateIORequest
  475.         move.l    d0,TimerIO(bp)
  476.         beq.s    1$
  477.         move.l    d0,a1
  478.         lea    TimerName(pc),a0
  479.         moveq    #1,d0            ; UNIT_VBLANK
  480.         moveq    #0,d1
  481.         RECALL    OpenDevice
  482.         tst.l    d0
  483.         bne.s    2$            ; no timer.device !
  484.         st    TimerOpen(bp)
  485.         RECALL    CreateMsgPort
  486.         move.l    d0,AudioPort(bp)
  487.         beq.s    1$
  488.         move.l    d0,a0
  489.         moveq    #68,d0
  490.         RECALL    CreateIORequest
  491.         move.l    d0,AudioIO+4(bp)
  492.         beq.s    1$
  493.         moveq    #68,d0
  494.         move.l    AudioPort(bp),a0
  495.         RECALL    CreateIORequest
  496.         move.l    d0,AudioIO+0(bp)
  497.         beq.s    1$
  498.         move.l    d0,a1
  499.         lea    AudioName(pc),a0
  500.         moveq    #0,d0
  501.         moveq    #0,d1
  502.         RECALL    OpenDevice
  503.         tst.l    d0
  504.         bne.s    2$            ; no audio.device !
  505.         st    AudioOpen(bp)
  506.         moveq    #8,d0
  507.         move.l    #$10003,d1
  508.         RECALL    AllocMem
  509.         move.l    d0,WaveForm(bp)
  510.         beq.s    1$
  511.         move.l    d0,a0
  512.         move.l    #$7f807f80,0(a0)    ; rectangle
  513. 1$        rts
  514. 2$        moveq    #0,d0
  515.         rts
  516.  
  517. ***************************************************************************
  518.  
  519. ReadArgs    move.l    WbMsg(bp),d0        ; get program arguments
  520.         beq    isCLI
  521.  
  522. isWB        move.l    d0,a0
  523.         move.l    28(a0),d0
  524.         move.l    36(a0),a0
  525.         subq.l    #1,d0
  526.         beq.s    1$
  527.         addq.w    #8,a0
  528. 1$        move.l    (a0)+,d1        ; copy to internal arg
  529.         move.l    d1,PrgArg+0(bp)
  530.         move.l    0(a0),PrgArg+4(bp)
  531.         CALL    CurrentDir,DosBase(bp)    ; workbench directory
  532.         move.l    d0,OldLock(bp)
  533.         st    changeddir(bp)        ; flag for changed lock
  534.  
  535. MergeToolTypes    movem.l    d2-d6/a2,-(sp)
  536.         moveq    #0,d4
  537.         lea    linefeed(pc),a2        ; default string
  538.         moveq    #1,d2
  539.         move.l    PrgArg+0(bp),d1
  540.         CALL    CurrentDir,DosBase(bp)    ; change to 'progdir'
  541.         move.l    d0,d3
  542.         move.l    PrgArg+4(bp),a0
  543.         CALL    GetDiskObject,IconBase(bp)
  544.         move.l    d0,d6
  545.         beq.s    2$            ; no icon ?!
  546.         move.l    d6,a0
  547.         move.l    54(a0),a0        ; calc needed buffer length
  548.         moveq    #1,d5
  549. 9$        move.l    (a0)+,d1
  550.         beq.s    7$            ; table end
  551.         move.l    d1,a1
  552. 8$        tst.b    (a1)+
  553.         bne.s    8$
  554.         sub.l    d1,a1
  555.         add.l    a1,d5
  556.         bra.s    9$
  557. 7$        moveq    #7,d0            ; adjust to multiple of eight
  558.         add.l    d5,d0
  559.         andi.w    #-8,d0
  560.         moveq    #0,d1
  561.         CALL    AllocVec,SysBase(bp)
  562.         move.l    d0,d4
  563.         beq.s    3$            ; no buffer
  564.         move.l    d6,a2
  565.         move.l    54(a2),a2
  566.         move.l    d4,a1
  567. 6$        move.l    (a2)+,d0
  568.         beq.s    4$            ; table end
  569.         move.l    d0,a0
  570. 5$        move.b    (a0)+,(a1)+        ; build argument string
  571.         bne.s    5$
  572.         move.b    #' ',-1(a1)
  573.         bra.s    6$
  574. 4$        move.b    #10,(a1)        ; terminate string
  575.         move.l    d4,a2
  576.         move.l    d5,d2
  577. 3$        move.l    d6,a0
  578.         CALL    FreeDiskObject,IconBase(bp)
  579. 2$        move.l    d2,d0
  580.         move.l    a2,a0
  581.         bsr.s    ParseArgs        ; parse string
  582.         move.l    d0,d2
  583.         move.l    d4,d0
  584.         beq.s    1$            ; have we a vector ?
  585.         move.l    d0,a1
  586.         CALL    FreeVec,SysBase(bp)    ; free arg string
  587. 1$        move.l    d3,d1
  588.         CALL    CurrentDir,DosBase(bp)    ; return to olddir
  589.         move.l    d2,d0
  590.         movem.l    (sp)+,d2-d6/a2
  591.         rts
  592.  
  593. isCLI        moveq    #124,d0            ; build internal arg
  594.         moveq    #0,d1
  595.         CALL    AllocVec,SysBase(bp)
  596.         move.l    d0,a2
  597.         move.l    a2,NameBuf(bp)
  598.         beq.s    isCLI-2
  599.         CALL    GetProgramDir,DosBase(bp)
  600.         move.l    d0,PrgArg+0(bp)
  601.         move.l    a2,d1
  602.         moveq    #124,d2
  603.         RECALL    GetProgramName
  604.         move.l    a2,d1
  605.         RECALL    FilePart
  606.         move.l    d0,PrgArg+4(bp)
  607.  
  608.         moveq    #0,d0
  609.         suba.l    a0,a0
  610.  
  611. ParseArgs    movem.l    d2-d4/a2/a3,-(sp)
  612.         move.l    a0,a2            ; save args
  613.         move.l    d0,a3
  614.         moveq    #ArgCount-1,d0
  615. 12$        clr.l    -(sp)            ; clear buffer
  616.         dbra    d0,12$
  617.         moveq    #5,d1
  618.         moveq    #0,d2
  619.         CALL    AllocDosObject,DosBase(bp)
  620.         move.l    d0,d3
  621.         beq.s    10$
  622.         move.l    d0,a0
  623.         movem.l    a2/a3,0(a0)        ; CS_Source,CS_Length
  624.         lea    template(pc),a1
  625.         move.l    a1,d1
  626.         move.l    sp,d2
  627.         tst.l    0(a0)
  628.         bne.s    11$            ; is WB
  629.         addq.l    #3,d1
  630.         addq.l    #4,d2
  631. 11$        RECALL    ReadArgs
  632. 10$        move.l    d0,d4
  633.         lea    4(sp),a2
  634.         moveq    #50,d0            ; erg[0]
  635.         moveq    #0,d1
  636.         bsr    GetLong
  637.         move.l    d0,Oben(bp)
  638.         moveq    #50,d0            ; erg[1]
  639.         moveq    #0,d1
  640.         bsr    GetLong
  641.         move.l    d0,Links(bp)
  642.         moveq    #108,d0            ; erg[2]
  643.         moveq    #10,d1
  644.         bsr    GetLong
  645.         move.l    d0,Breite(bp)
  646.         moveq    #54,d0            ; erg[3]
  647.         moveq    #10,d1
  648.         bsr    GetLong
  649.         move.l    d0,Hoehe(bp)
  650.         move.l    (a2)+,d0        ; erg[4]
  651.         move.b    d0,sekunden(bp)
  652.         lea    Must(bp),a1        ; erg[5]
  653.         move.l    a1,a0
  654.         moveq    #4-1,d0
  655.         bsr    ReadStr
  656.         move.l    (a2)+,d0        ; erg[6]
  657.         move.b    d0,oval(bp)
  658.         move.l    (a2)+,d0        ; erg[7]
  659.         move.b    d0,schatten(bp)
  660.         moveq    #1,d0
  661.         moveq    #4,d1
  662.         bsr    GetByte            ; erg[8]
  663.         move.b    d0,zeigen(bp)
  664.         moveq    #2,d0
  665.         moveq    #3,d1
  666.         bsr    GetByte            ; erg[9]
  667.         move.b    d0,zeigertyp(bp)
  668.         moveq    #2,d0
  669.         moveq    #4,d1
  670.         bsr    GetByte            ; erg[10]
  671.         move.b    d0,zeigerbreite(bp)
  672.         lea    Pens(bp),a1
  673.         lea    pens(pc),a0
  674.         moveq    #14-1,d0
  675.         bsr    ReadStr            ; erg[11]
  676.         moveq    #6,d0
  677.         moveq    #2+4+8,d1
  678.         bsr    GetByte            ; erg[12]
  679.         moveq    #4,d1
  680.         and.b    d0,d1
  681.         sne    hires(bp)
  682.         sub.b    d1,d0
  683.         moveq    #8,d1
  684.         and.b    d0,d1
  685.         sne    interlace(bp)
  686.         sub.b    d1,d0
  687.         move.b    d0,rahmenanz(bp)
  688.         moveq    #0,d0
  689.         moveq    #2+4,d1
  690.         bsr    GetByte            ; erg[13]
  691.         moveq    #4,d1
  692.         and.b    d0,d1
  693.         sne    smarthour(bp)
  694.         sub.b    d1,d0
  695.         move.b    d0,chime(bp)
  696.         move.l    (a2)+,d0        ; erg[14]
  697.         move.b    d0,closegad(bp)
  698.         move.l    (a2)+,d0        ; erg[15]
  699.         move.b    d0,useimage(bp)
  700.         move.l    (a2)+,d0        ; erg[16]
  701.         move.b    d0,noremap(bp)
  702.         move.l    (a2)+,d2        ; erg[17]
  703.         beq.s    7$
  704.         move.l    d2,a0
  705. 9$        tst.b    (a0)+            ; strlen()
  706.         bne.s    9$
  707.         sub.l    d2,a0
  708.         move.l    a0,d0
  709.         moveq    #0,d1
  710.         CALL    AllocVec,SysBase(bp)
  711.         move.l    d0,ImgName(bp)
  712.         beq.s    7$
  713.         move.l    d2,a0
  714.         move.l    d0,a1
  715. 8$        move.b    (a0)+,(a1)+        ; copy string
  716.         bne.s    8$
  717. 7$        move.l    IntBase(bp),a6
  718.         move.l    (a2)+,d0        ; erg[18]
  719.         beq.s    6$
  720.         move.l    d0,a0
  721.         RECALL    LockPubScreen
  722.         tst.l    d0            ; ok ?
  723.         bne.s    5$
  724. 6$        move.l    d0,a0            ; lock default pub screen
  725.         RECALL    LockPubScreen
  726. 5$        move.l    d0,PubScreen(bp)
  727.         move.l    (a2)+,d0        ; erg[19]
  728.         beq.s    3$
  729.         move.l    d0,a0
  730.         move.l    0(a0),d0
  731.         moveq    #5,d1
  732.         add.l    d0,d1
  733.         moveq    #10,d2
  734.         cmp.l    d1,d2
  735.         bcc.s    4$
  736.         moveq    #0,d0
  737. 4$        move.l    OurTask(bp),a1
  738.         CALL    SetTaskPri,SysBase(bp)
  739.         move.b    d0,OldPri+3(bp)
  740.         st    changedpri(bp)
  741. 3$        move.l    DosBase(bp),a6
  742.         move.l    d4,d1
  743.         beq.s    2$
  744.         RECALL    FreeArgs
  745. 2$        move.l    d3,d2
  746.         beq.s    1$
  747.         moveq    #5,d1
  748.         RECALL    FreeDosObject
  749. 1$        move.l    PubScreen(bp),d0    ; can we continue ?
  750.         lea    (ArgCount*4)(sp),sp
  751.         movem.l    (sp)+,d2-d4/a2/a3
  752.         rts
  753.  
  754. GetLong        bsr.s    GetVal
  755.         beq.s    1$
  756.         cmp.l    d1,d2
  757.         bcs.s    1$
  758.         move.l    d2,d0
  759. 1$        rts
  760.  
  761. GetByte        bsr.s    GetVal
  762.         beq.s    1$
  763.         cmp.l    d2,d1
  764.         bcs.s    1$
  765.         move.l    d2,d0
  766. 1$        rts
  767.  
  768. GetVal        move.l    (a2)+,d2
  769.         beq.s    1$
  770.         move.l    d2,a0
  771.         move.l    0(a0),d2
  772.         cmp.l    a2,d2            ; for flags !
  773. 1$        rts
  774.  
  775. ReadStr        move.w    d0,d1
  776. 5$        move.b    0(a0,d0.w),0(a1,d0.w)    ; copy defaults
  777.         dbra    d0,5$
  778.         move.l    (a2)+,d0
  779.         beq.s    1$            ; no argument !
  780.         move.l    d0,a0
  781.         move.b    (a0)+,d0        ; if (*sorc='$'||toupper(*sorc)='X'||..)
  782.         cmpi.b    #'$',d0
  783.         beq.s    4$
  784.         andi.b    #$5f,d0
  785.         cmpi.b    #'X',d0
  786.         beq.s    4$
  787.         move.b    -1(a0),d0
  788.         lsl.w    #8,d0
  789.         move.b    (a0)+,d0
  790.         andi.w    #$ff5f,d0
  791.         cmpi.w    #'0X',d0
  792.         bne.s    3$
  793. 4$        move.b    (a0)+,d0        ; while (*sorc++ && *sorc++ && n--)
  794.         beq.s    1$
  795.         tst.b    (a0)
  796.         beq.s    1$
  797.         bsr.s    xtod
  798.         lsl.b    #4,d0
  799.         move.b    d0,(a1)
  800.         move.b    (a0)+,d0
  801.         bsr.s    xtod
  802.         or.b    d0,(a1)+        ; *dest++=xtod(sorc[-1])<<4+xtdo(*sorc);
  803.         dbra    d1,4$
  804.         bra.s    1$
  805. 3$        subq.w    #2,a0            ; else {
  806. 2$        move.b    (a0)+,d0        ;   while (*sorc++ && n--)
  807.         beq.s    1$
  808.         bsr.s    xtod
  809.         move.b    d0,(a1)+        ;     *dest++=xtod(*sorc);
  810.         dbra    d1,2$            ; }
  811. 1$        rts
  812.  
  813. xtod        addi.b    #-'0',d0        ; if (a >='0' && a<='9')
  814.         bcc.s    2$            ;   return (a-'0');
  815.         cmpi.b    #10,d0
  816.         bcs.s    1$
  817.         cmpi.b    #'a'-'0',d0        ; if (a >='a' && a<='f')
  818.         bcs.s    3$            ;   return (a-'a'+10);
  819.         addi.b    #-32,d0
  820. 3$        subq.b    #7,d0            ; if (a >='A' && a<='F');
  821.         cmpi.b    #10,d0            ;   return (a-'A'+10);
  822.         bcs.s    2$
  823.         cmpi.b    #16,d0
  824.         bcs.s    1$
  825. 2$        moveq    #0,d0            ; return(0);
  826. 1$        rts
  827.  
  828. ***************************************************************************
  829.  
  830. OpenLibs    move.l    SysBase(bp),a6        ; open all libs
  831.         lea    DosName(pc),a1
  832.         bsr.s    OpenLib
  833.         move.l    d0,DosBase(bp)
  834.         beq.s    1$            ; no dos v37+ !
  835.         lea    IconName(pc),a1
  836.         bsr.s    OpenLib
  837.         move.l    d0,IconBase(bp)
  838.         beq.s    1$            ; no icon v37+ !
  839.         lea    IntName(pc),a1
  840.         bsr.s    OpenLib
  841.         move.l    d0,IntBase(bp)
  842.         beq.s    1$            ; no intuition v37+ !
  843.         lea    GfxName(pc),a1
  844.         bsr.s    OpenLib
  845.         move.l    d0,GfxBase(bp)
  846.         beq.s    1$            ; no graphics v37+ !
  847.         lea    GadsName(pc),a1
  848.         bsr.s    OpenLib
  849.         move.l    d0,GadsBase(bp)
  850.         beq.s    1$            ; no gadtools v37+ !
  851.         lea    DtName(pc),a1
  852.         moveq    #39,d0
  853.         RECALL    OpenLibrary
  854.         move.l    d0,DtBase(bp)        ; datatypes v39+ ?
  855.         lea    LocName(pc),a1
  856.         moveq    #38,d0
  857.         RECALL    OpenLibrary
  858.         move.l    d0,LocBase(bp)
  859.         beq.s    2$            ; no locale v38+ !
  860.         suba.l    a0,a0
  861.         lea    LocCat(pc),a1        ; our catalog 
  862.         suba.l    a2,a2
  863.         CALL    OpenCatalogA,d0
  864.         move.l    d0,Catalog(bp)
  865. 2$        moveq    #1,d0            ; all ok  
  866. 1$        rts
  867.  
  868. OpenLib        moveq    #37,d0            ; open lib v37+
  869.         jmp    _LVOOpenLibrary(a6)
  870.  
  871. ***************************************************************************
  872.  
  873. main        movem.l    d2-d7/a2-a6,-(sp)    ; main program
  874.         bsr    OpenLibs
  875.         beq    1$
  876.         bsr    OpenDevs
  877.         beq    1$
  878.         bsr    ReadArgs
  879.         beq.s    1$
  880.         bsr    InitClock
  881.         beq.s    1$
  882. 6$        moveq    #$40,d0            ; while (!CTRL-C && !EndAll) {
  883.         lsl.w    #6,d0
  884.         move.l    WinPort(bp),a1
  885.         move.b    15(a1),d1
  886.         bset    d1,d0
  887.         move.l    TimerPort(bp),a1
  888.         move.b    15(a1),d1
  889.         bset    d1,d0
  890.         move.l    AudioPort(bp),a1
  891.         move.b    15(a1),d1
  892.         bset    d1,d0
  893.         move.l    AboutReq(bp),d1
  894.         beq.s    5$            ; no about requester
  895.         move.l    d1,a1
  896.         move.l    86(a1),a1
  897.         move.b    15(a1),d1
  898.         bset    d1,d0
  899. 5$        CALL    Wait,SysBase(bp)
  900.         btst    #12,d0            ; CTRL-C ?
  901.         bne.s    1$
  902.         move.l    TimerPort(bp),a0    ; if (GetMsg(TimerPort))
  903.         RECALL    GetMsg
  904.         tst.l    d0
  905.         beq.s    3$
  906.         bsr    NextTick        ; if (NextTick())
  907.         beq.s    4$
  908.         bsr    ZifferBlatt
  909.         bsr    TestAlarm
  910. 4$        bsr    Zeichnen
  911. 3$        move.l    AudioPort(bp),a0    ; if (GetMsg(AudioPort))
  912.         RECALL    GetMsg
  913.         tst.l    d0
  914.         beq.s    2$
  915.         bsr    PlayNote
  916. 2$        bsr    CheckAboutReq
  917.         bsr    CheckWindows
  918.         beq    6$            ; }
  919. 1$        bsr    CloseGfx
  920.         bsr    CloseDevs
  921.         bsr    CloseLibs
  922.         movem.l    (sp)+,d2-d7/a2-a6    ; exit main 
  923.         rts
  924.  
  925. ***************************************************************************
  926.  
  927. CloseLibs    move.l    Catalog(bp),d0        ; close catalog
  928.         beq.s    3$
  929.         move.l    d0,a0
  930.         CALL    CloseCatalog,LocBase(bp)
  931. 3$        move.l    SysBase(bp),a6        ; close all libs
  932.         move.l    LocBase(bp),a1
  933.         bsr.s    2$
  934.         move.l    DtBase(bp),a1
  935.         bsr.s    2$
  936.         move.l    GadsBase(bp),a1
  937.         bsr.s    2$
  938.         move.l    GfxBase(bp),a1
  939.         bsr.s    2$
  940.         move.l    IntBase(bp),a1
  941.         bsr.s    2$
  942.         move.l    IconBase(bp),a1
  943.         bsr.s    2$
  944.         move.l    DosBase(bp),a1
  945. 2$        move.l    a1,d0
  946.         beq.s    1$
  947.         RECALL    CloseLibrary
  948. 1$        rts
  949.  
  950. ***************************************************************************
  951.  
  952. CloseDevs    tst.b    changeddir(bp)        ; cleanup
  953.         beq.s    11$
  954.         move.l    OldLock(bp),d1
  955.         CALL    CurrentDir,DosBase(bp)
  956. 11$        move.l    SysBase(bp),a6
  957.         tst.b    changedpri(bp)
  958.         beq.s    10$
  959.         move.l    OurTask(bp),a1
  960.         move.l    OldPri(bp),d0
  961.         RECALL    SetTaskPri        ; restore old pri
  962. 10$        move.l    ImgName(bp),d0        ; free pic name buffer
  963.         beq.s    9$
  964.         move.l    d0,a1
  965.         RECALL    FreeVec
  966. 9$        move.l    NameBuf(bp),d0        ; free cli name buffer
  967.         beq.s    8$
  968.         move.l    d0,a1
  969.         RECALL    FreeVec
  970. 8$        tst.b    AudioOpen(bp)        ; free audio stuff
  971.         beq.s    4$
  972.         move.l    AudioIO+4(bp),a2
  973.         tst.b    AudioSent+1(bp)
  974.         beq.s    7$            ; io not active
  975.         bsr.s    StopIO
  976. 7$        move.l    AudioIO+0(bp),a2
  977.         tst.b    AudioSent+0(bp)
  978.         beq.s    6$            ; io not active
  979.         bsr.s    StopIO
  980. 6$        tst.b    SoundOn(bp)
  981.         beq.s    5$            ; no channels allocated
  982.         bsr    EndTune
  983. 5$        bsr.s    CloseDev
  984. 4$        move.l    AudioIO+4(bp),a0    ; delete io's && port
  985.         bsr.s    DeleteIO
  986.         move.l    AudioIO+0(bp),a0
  987.         bsr.s    DeleteIO
  988.         move.l    AudioPort(bp),a0
  989.         bsr.s    DeletePort
  990.         move.l    WaveForm(bp),d0
  991.         beq.s    3$            ; no wave mem
  992.         move.l    d0,a1
  993.         moveq    #8,d0
  994.         RECALL    FreeMem
  995. 3$        tst.b    TimerOpen(bp)        ; free timer stuff
  996.         beq.s    1$
  997.         move.l    TimerIO(bp),a2
  998.         tst.b    TimerSent(bp)
  999.         beq.s    2$            ; io not active
  1000.         bsr.s    StopIO
  1001. 2$        bsr.s    CloseDev
  1002. 1$        move.l    TimerIO(bp),a0        ; delete io && port
  1003.         bsr.s    DeleteIO
  1004.         move.l    TimerPort(bp),a0
  1005.         bsr.s    DeletePort
  1006.         move.l    WinPort(bp),a0
  1007.  
  1008. ;--------------------------------------------------------------------------
  1009.  
  1010. DeletePort    move.l    a0,d0
  1011.         beq.s    1$            ; no port
  1012.         RECALL    DeleteMsgPort
  1013. 1$        rts
  1014.  
  1015. ;--------------------------------------------------------------------------
  1016.  
  1017. DeleteIO    move.l    a0,d0
  1018.         beq.s    1$            ; no ioreq
  1019.         RECALL    DeleteIORequest
  1020. 1$        rts
  1021.  
  1022. ;--------------------------------------------------------------------------
  1023.  
  1024. CloseDev    move.l    a2,a1            ; close device
  1025.         jmp    _LVOCloseDevice(a6)
  1026.  
  1027. ;--------------------------------------------------------------------------
  1028.  
  1029. StopIO        move.l    a2,a1            ; end active io
  1030.         RECALL    AbortIO
  1031.         move.l    a2,a1
  1032.         jmp    _LVOWaitIO(a6)
  1033.  
  1034. ***************************************************************************
  1035.  
  1036. NewSize1    move.l    GfxBase(bp),a6        ; free gfx stuff 2
  1037.         move.l    Buf(bp),d0
  1038.         beq.s    4$
  1039.         move.l    d0,a0
  1040.         move.l    Breit2(bp),d0
  1041.         move.l    Hoehe2(bp),d1
  1042.         RECALL    FreeRaster        ; free buffer
  1043.         clr.l    Buf(bp)
  1044. 4$        lea    BitMap1+8(bp),a2
  1045.         move.b    BitMap1+5(bp),d2
  1046.         beq.s    1$
  1047. 3$        move.l    0(a2),d0
  1048.         beq.s    2$            ; nothing !
  1049.         move.l    d0,a0
  1050.         move.l    Breit2(bp),d0
  1051.         move.l    Hoehe2(bp),d1
  1052.         RECALL    FreeRaster        ; free bitplane
  1053. 2$        clr.l    (a2)+
  1054.         subq.b    #1,d2
  1055.         bne.s    3$            ; not ready
  1056. 1$        rts
  1057.  
  1058. ;--------------------------------------------------------------------------
  1059.  
  1060. CloseAboutReq    move.l    AboutReq(bp),d0
  1061.         beq.s    1$
  1062.         move.l    d0,a0
  1063.         CALL    FreeSysRequest,IntBase(bp)
  1064.         clr.l    AboutReq(bp)
  1065. 1$        rts
  1066.  
  1067. ;--------------------------------------------------------------------------
  1068.  
  1069. CloseGfx    bsr.s    NewSize1        ; free gfx stuff
  1070.         bsr.s    CloseAboutReq
  1071.         bsr.s    CloseAlmWin
  1072.         bsr.s    CloseColWin
  1073.         move.l    WinPtr(bp),d2
  1074.         bsr.s    CloseWinSafely
  1075.         move.l    GadsBase(bp),a6
  1076.         move.l    Menus(bp),d0
  1077.         beq.s    4$
  1078.         move.l    d0,a0
  1079.         RECALL    FreeMenus
  1080. 4$        move.l    VisualInfo(bp),d0
  1081.         beq.s    3$
  1082.         move.l    d0,a0
  1083.         RECALL    FreeVisualInfo
  1084. 3$        move.l    ImgObject(bp),d0
  1085.         beq.s    2$
  1086.         move.l    d0,a0
  1087.         CALL    DisposeDTObject,DtBase(bp)
  1088. 2$        move.l    PubScreen(bp),d0
  1089.         beq.s    1$
  1090.         move.l    d0,a1
  1091.         suba.l    a0,a0
  1092.         CALL    UnlockPubScreen,IntBase(bp)
  1093. 1$        rts
  1094.  
  1095. ;--------------------------------------------------------------------------
  1096.  
  1097. CloseAlmWin    lea    AlmWin(bp),a0        ; discard alarm window
  1098.         bra.s    CloseWinGT
  1099.  
  1100. CloseColWin    lea    ColWin(bp),a0        ; discard color window
  1101.  
  1102. CloseWinGT    move.l    0(a0),d2
  1103.         clr.l    (a0)+
  1104.         move.l    0(a0),d3
  1105.         clr.l    0(a0)
  1106.         bsr.s    CloseWinSafely
  1107.         move.l    d3,a0
  1108.         move.l    a0,d3
  1109.         beq.s    1$
  1110.         CALL    FreeGadgets,GadsBase(bp)
  1111. 1$        rts
  1112.  
  1113. ;--------------------------------------------------------------------------
  1114.  
  1115. CloseWinSafely    move.l    d2,d0            ; window to close ?
  1116.         beq.s    1$
  1117.         CALL    Forbid,SysBase(bp)    ; protect us
  1118.         move.l    d2,a2
  1119.         move.l    86(a2),a2        ; assumes valid UserPort !
  1120.         move.l    20(a2),a2        ; msg=mp->MsgList.lh_Head;
  1121.         move.l    0(a2),d0
  1122.         beq.s    2$
  1123. 4$        move.l    d0,a3
  1124.         cmp.l    44(a2),d2        ; msg for this window ?
  1125.         bne.s    3$
  1126.         move.l    a2,a1
  1127.         RECALL    Remove            ; remove msg from list
  1128.         move.l    a2,a1
  1129.         RECALL    ReplyMsg        ; send it back
  1130. 3$        move.l    a3,a2
  1131.         move.l    0(a2),d0
  1132.         bne.s    4$            ; more messages to process
  1133. 2$        move.l    d2,a0
  1134.         clr.l    86(a0)            ; clear UserPort
  1135.         moveq    #0,d0
  1136.         CALL    ModifyIDCMP,IntBase(bp)    ; shutdown IDCMP
  1137.         move.l    d2,a0
  1138.         RECALL    ClearMenuStrip        ; remove menus (if any)
  1139.         move.l    d2,a0
  1140.         RECALL    CloseWindow        ; close window
  1141.         CALL    Permit,SysBase(bp)
  1142. 1$        rts
  1143.  
  1144. ***************************************************************************
  1145.  
  1146. CheckAboutReq    move.l    a6,-(sp)        ; process 'about' request
  1147.         move.l    AboutReq(bp),d0
  1148.         beq.s    1$
  1149.         sub.l    a1,a1
  1150.         move.l    d0,a0
  1151.         moveq    #0,d0
  1152.         CALL    SysReqHandler,IntBase(bp) ; system handler
  1153.         addq.l    #2,d0
  1154.         beq.s    1$
  1155.         bsr    CloseAboutReq
  1156. 1$        move.l    (sp)+,a6
  1157.         rts
  1158.  
  1159. ***************************************************************************
  1160.  
  1161. CheckWindows    movem.l    d2/d3/a2/a3/a6,-(sp)
  1162. 4$        move.l    WinPort(bp),a0        ; while (msg=GT_GetIMsg(Port)) {
  1163.         CALL    GT_GetIMsg,GadsBase(bp)
  1164.         move.l    d0,a1
  1165.         move.l    a1,d0
  1166.         beq.s    1$
  1167.         move.l    20(a1),d2        ; imClass
  1168.         move.w    24(a1),d3        ; imCode
  1169.         move.l    28(a1),a2        ; IAdress
  1170.         move.l    44(a1),a3        ; IDCMPWindow
  1171.         RECALL    GT_ReplyIMsg
  1172.         pea    2$(pc)
  1173.         cmp.l    WinPtr(bp),a3
  1174.         beq    ProcessMainWin
  1175.         cmp.l    ColWin(bp),a3
  1176.         beq    ProcessColWin
  1177.         cmp.l    AlmWin(bp),a3
  1178.         beq    ProcessAlmWin
  1179.         addq.w    #4,sp
  1180. 2$        tst.b    EndAll(bp)        ; quit ?
  1181.         beq.s    4$
  1182. 1$        movem.l    (sp)+,d2/d3/a2/a3/a6    ; }
  1183.         rts
  1184.  
  1185. ***************************************************************************
  1186.  
  1187. ProcessAlmWin    moveq    #($200>>3),d0        ; CLOSEWINDOW
  1188.         lsl.w    #3,d0
  1189.         cmp.l    d0,d2
  1190.         beq.s    2$
  1191.         moveq    #$40,d0            ; GADGETUP
  1192.         cmp.l    d0,d2
  1193.         beq.s    6$
  1194.         moveq    #$10,d0            ; MOUSEMOVE
  1195.         bne.s    1$
  1196. 6$        move.w    38(a2),d0
  1197.         subq.w    #1,d0            ; hour slider ?
  1198.         bne.s    5$
  1199.         move.w    d3,st(bp)
  1200.         bra.s    1$
  1201. 5$        subq.w    #1,d0            ; minute SLIDER ?
  1202.         bne.s    4$
  1203.         move.w    d3,mi(bp)
  1204.         bra.s    1$
  1205. 4$        subq.w    #1,d0            ; USE ?
  1206.         bne.s    3$
  1207.         move.w    st(bp),alstd(bp)
  1208.         move.w    mi(bp),almin(bp)
  1209.         st    alarm(bp)
  1210.         bra.s    2$
  1211. 3$        subq.w    #1,d0            ; CANCEL ?
  1212.         bne.s    1$
  1213. 2$        bsr    CloseAlmWin
  1214.         tst.b    alarm(bp)
  1215.         beq.s    1$            ; 
  1216.         move.l    Menus(bp),a0
  1217.         move.l    #$8e1,d0        ; FULLMENUNUM(1,7,1);
  1218.         CALL    ItemAddress,IntBase(bp)
  1219.         move.l    d0,a2
  1220.         moveq    #1,d0
  1221.         and.b    12(a2),d0
  1222.         bne.s    1$            ; already ckecked !
  1223.         move.l    WinPtr(bp),a0
  1224.         RECALL    ClearMenuStrip
  1225.         or.b    #1,12(a2)        ; item->Flags |= CHECKED;
  1226.         move.l    WinPtr(bp),a0
  1227.         move.l    Menus(bp),a1
  1228.         RECALL    ResetMenuStrip
  1229. 1$        rts
  1230.  
  1231. ***************************************************************************
  1232.  
  1233. ProcessColWin    moveq    #($200>>3),d0        ; CLOSEWINDOW
  1234.         lsl.w    #3,d0
  1235.         cmp.l    d0,d2
  1236.         beq.s    2$
  1237.         moveq    #$40,d0            ; GADGETUP
  1238.         cmp.l    d0,d2
  1239.         bne.s    1$
  1240.         move.l    color(bp),a0
  1241.         move.b    d3,0(a0)        ; set new color
  1242.         bsr    SetPattern
  1243.         bsr    Rahmen
  1244.         bsr    ZifferBlatt
  1245.         bsr    Zeichnen
  1246. 2$        bsr    CloseColWin
  1247. 1$        rts
  1248.  
  1249. ***************************************************************************
  1250.  
  1251. ProcessMainWin    move.l    IntBase(bp),a6        ; setup a6
  1252.         moveq    #2,d1
  1253.         cmp.l    d1,d2
  1254.         beq.s    msgNewSize        ; CASE NEWSIZE
  1255.         moveq    #4,d1
  1256.         cmp.l    d1,d2
  1257.         beq.s    msgRefresh        ; CASE REFRESHWINDOW
  1258.         moveq    #($100>>2),d1
  1259.         add.w    d1,d1
  1260.         add.w    d1,d1
  1261.         cmp.l    d1,d2
  1262.         beq.s    msgMenuPick        ; CASE MENUPICK
  1263.         add.l    d1,d1
  1264.         cmp.l    d1,d2
  1265.         beq.s    msgCloseWin        ; case CLOSEWINDOW
  1266.         moveq    #4,d1
  1267.         swap    d1
  1268.         cmp.l    d1,d2
  1269.         beq.s    msgActInact        ; CASE ACTIVEWINDOW
  1270.         add.l    d1,d1
  1271.         cmp.l    d1,d2
  1272.         bne.s    msgNop            ; not CASE INACTIVEWINDOW
  1273.  
  1274. ;--------------------------------------------------------------------------
  1275.  
  1276.         moveq    #1,d0
  1277. msgActInact    seq    Active(bp)
  1278.         bra    Rahmen
  1279.  
  1280. ;--------------------------------------------------------------------------
  1281.  
  1282. msgCloseWin    tst.b    closegad(bp)
  1283.         beq.s    msgNop            ; close gadget off !
  1284.  
  1285. projectQuit    st    EndAll(bp)
  1286. msgNop        rts
  1287.  
  1288. ;--------------------------------------------------------------------------
  1289.  
  1290. msgRefresh    move.l    BoLeft(bp),d0
  1291.         move.l    d0,ReDrawx1(bp)
  1292.         move.l    BoTop(bp),d1
  1293.         move.l    d1,ReDrawy1(bp)
  1294.         add.l    Breit2(bp),d0
  1295.         subq.l    #1,d0
  1296.         move.l    d0,ReDrawx2(bp)
  1297.         add.l    Hoehe2(bp),d1
  1298.         subq.l    #1,d1
  1299.         move.l    d1,ReDrawy2(bp)
  1300.         move.l    WinPtr(bp),a0
  1301.         RECALL    BeginRefresh
  1302.         bsr    Rahmen
  1303.         bsr    Zeichnen
  1304.         moveq    #1,d0
  1305.         move.l    WinPtr(bp),a0
  1306.         jmp    _LVOEndRefresh(a6)
  1307.  
  1308. ;--------------------------------------------------------------------------
  1309.  
  1310. msgNewSize    bsr    NewSize1
  1311.         bsr    NewSize2
  1312.         beq.s    projectQuit        ; error !
  1313.         bsr    Rahmen
  1314.         bsr    ZifferBlatt
  1315.         bra    Zeichnen
  1316.  
  1317. ;--------------------------------------------------------------------------
  1318.  
  1319. msgMenuPick    moveq    #0,d2            ; while (code != MENUNULL) {
  1320.         move.w    d3,d2
  1321.         addq.w    #1,d3
  1322.         beq.s    1$
  1323.         move.l    d2,d0
  1324.         move.l    Menus(bp),a0
  1325.         CALL    ItemAddress,IntBase(bp)
  1326.         move.l    d0,a2
  1327.         move.w    32(a2),d3
  1328.         moveq    #$1f,d0
  1329.         and.w    d2,d0            ; MENUNUM
  1330.         add.w    d0,d0            ; now index !
  1331.         move.w    d2,d1
  1332.         lsr.w    #5,d1
  1333.         andi.w    #$3f,d1            ; ITEMNUM
  1334.         lsr.w    #8,d2
  1335.         lsr.w    #3,d2
  1336.         andi.w    #$1f,d2            ; SUBNUM
  1337.         move.w    menuTab(pc,d0.w),d0
  1338.         jsr    menuTab(pc,d0.w)    ; execute CASE
  1339.         bsr    msgNewSize
  1340.         bne.s    msgMenuPick        ; no error !
  1341. 1$        rts                ; }
  1342.  
  1343. menuTab        ADDCMD    menu,Project,0
  1344.         ADDCMD    menu,Settings
  1345.         ADDCMD    menu,Colors
  1346.         ADDCMD    menu,Pattern
  1347.  
  1348. ;--------------------------------------------------------------------------
  1349.  
  1350. menuProject    add.w    d1,d1            ; now index !
  1351.         move.w    projectTab(pc,d1.w),d1
  1352.         jmp    projectTab(pc,d1.w)
  1353.  
  1354. projectTab    ADDCMD    project,About,0
  1355.         ADDCMD    project,Quit
  1356.  
  1357. projectAbout    tst.l    AboutReq(bp)
  1358.         bne.s    1$
  1359.         lea    EasyBuf(bp),a2
  1360.         moveq    #20,d0
  1361.         move.l    d0,(a2)+        ; structSize
  1362.         clr.l    (a2)+            ; flags
  1363.         moveq    #About,d0
  1364.         bsr    GetLocStr
  1365.         move.l    d0,(a2)+        ; reqTitle
  1366.         lea    ProgName(pc),a0
  1367.         move.l    a0,(a2)+        ; reqText
  1368.         moveq    #Description,d0
  1369.         bsr    GetLocStr
  1370.         move.l    d0,(a2)            ; gadText
  1371.         moveq    #0,d0
  1372.         move.l    WinPtr(bp),a0
  1373.         lea    EasyBuf(bp),a1
  1374. ;        suba.l    a3,a3            ; we don't have args !
  1375.         RECALL    BuildEasyRequestArgs
  1376.         moveq    #1,d1
  1377.         cmp.l    d0,d1
  1378.         bcc.s    1$
  1379.         move.l    d0,AboutReq(bp)
  1380. 1$        rts
  1381.  
  1382. ;--------------------------------------------------------------------------
  1383.  
  1384. menuSettings    add.w    d1,d1            ; now index !
  1385.         move.w    settingsTab(pc,d1.w),d1
  1386.         moveq    #1,d0
  1387.         and.b    12(a2),d0        ; checked=item.Flags&CHECKED;
  1388.         jmp    settingsTab(pc,d1.w)
  1389.  
  1390. settingsTab    ADDCMD    settings,Secs,0
  1391.         ADDCMD    settings,Oval
  1392.         ADDCMD    settings,Show
  1393.         ADDCMD    settings,Hands
  1394.         ADDCMD    settings,Shadow
  1395.         ADDCMD    settings,Border
  1396.         ADDCMD    settings,Chime
  1397.         ADDCMD    settings,Alarm
  1398.         ADDCMD    settings,UseImg
  1399.         ADDCMD    settings,CloseG
  1400.         ADDCMD    settings,Nop
  1401.         ADDCMD    settings,Save
  1402.  
  1403. settingsSecs    move.b    d0,sekunden(bp)        ; seconds on/off
  1404.         tst.b    TimerSent(bp)
  1405.         beq.s    1$
  1406.         clr.b    TimerSent(bp)
  1407.         move.l    TimerIO(bp),a1
  1408.         CALL    AbortIO,SysBase(bp)
  1409.         move.l    TimerIO(bp),a1
  1410.         RECALL    WaitIO
  1411. 1$        bra    NextTick
  1412.  
  1413. settingsOval    move.b    d0,oval(bp)        ; rectangle/oval
  1414. settingsNop    rts
  1415.  
  1416. settingsShow    beq.s    1$            ; zifferblatt
  1417.         move.b    d2,zeigen(bp)
  1418. 1$        rts
  1419.  
  1420. settingsHands    beq.s    1$            ; hands
  1421.         lea    zeigerbreite(bp),a2
  1422.         subq.w    #5,d2
  1423.         bcc.s    2$            ; 5-9
  1424.         addq.w    #5,d2
  1425.         lea    zeigertyp(bp),a2
  1426. 2$        move.b    d2,0(a2)
  1427. 1$        rts
  1428.  
  1429. settingsShadow    move.b    d0,schatten(bp)        ; shadow on/off
  1430.         rts
  1431.  
  1432. settingsBorder    lea    interlace(bp),a0    ; border type
  1433.         subq.w    #5,d2
  1434.         beq.s    2$
  1435.         lea    hires(bp),a0
  1436.         addq.w    #1,d2
  1437.         beq.s    2$
  1438.         tst.b    d0
  1439.         beq.s    1$
  1440.         lea    rahmenanz(bp),a0
  1441.         addq.w    #4,d2
  1442.         move.w    d2,d0
  1443. 2$        move.b    d0,0(a0)        ; interlace,hires or rahmenanz
  1444. 1$        rts
  1445.  
  1446. settingsChime    lea    smarthour(bp),a0    ; chime
  1447.         subq.w    #4,d2
  1448.         beq.s    2$
  1449.         tst.b    d0
  1450.         beq.s    1$
  1451.         lea    chime(bp),a0
  1452.         addq.w    #4,d2
  1453.         move.w    d2,d0
  1454. 2$        move.b    d0,0(a0)        ; smarthour or chime
  1455. 1$        rts
  1456.  
  1457. settingsAlarm    subq.w    #1,d2            ; which subitem ?
  1458.         bcc.s    alarmOn
  1459.  
  1460. alarmSet    tst.l    AlmWin(bp)
  1461.         bne.s    1$            ; already open !
  1462.         suba.l    a1,a1
  1463.         pea    almgadtags2(pc)
  1464.         pea    2            ; TAG_MORE,almgadtags2
  1465.         pea    fmt5(pc)
  1466.         pea    $8008002A        ; GSTL_Format,fmt5
  1467.         moveq    #0,d1
  1468.         move.w    almin(bp),d1
  1469.         move.w    d1,mi(bp)
  1470.         move.l    d1,-(sp)
  1471.         pea    $80080028        ; GSTL_Level,minute
  1472.         move.l    sp,d1
  1473.         suba.l    a0,a0
  1474.         pea    almgadtags1(pc)
  1475.         pea    2            ; TAG_MORE,almgadtags1
  1476.         pea    fmt4(pc)
  1477.         pea    $8008002A        ; GSTL_Format,fmt4
  1478.         moveq    #0,d0
  1479.         move.w    alstd(bp),d0
  1480.         move.w    d0,st(bp)
  1481.         move.l    d0,-(sp)
  1482.         pea    $80080028        ; GSTL_Level,hour
  1483.         move.l    sp,d0
  1484.         movem.l    d0/d1/a0/a1,-(sp)
  1485.         lea    almwintab(pc),a0
  1486.         move.l    sp,a1            ; **ptr
  1487.         bsr    CreateRequest
  1488.         lea    16*4(sp),sp
  1489.         movem.l    d0/d1,AlmWin(bp)    ; store window && gadgets
  1490. 1$        rts
  1491.  
  1492. alarmOn        move.b    d0,alarm(bp)        ; alarm on/off
  1493.         rts
  1494.  
  1495. settingsUseImg    move.w    #_LVOOffMenu,d1
  1496.         move.b    d0,useimage(bp)        ; image on/off
  1497.         bne.s    1$
  1498.         move.w    #_LVOOnMenu,d1
  1499. 1$        move.w    #$ffe3,d0
  1500.         move.l    WinPtr(bp),a0
  1501.         jmp    0(a6,d1.w)        ; OnMenu()/OffMenu()
  1502.  
  1503. settingsCloseG    move.b    d0,closegad(bp)        ; close gadget on/off
  1504.         rts
  1505.  
  1506. ;--------------------------------------------------------------------------
  1507.  
  1508. menuColors    lea    Pens(bp),a1        ; colors
  1509.         bra.s    GetColor
  1510.  
  1511. ;--------------------------------------------------------------------------
  1512.  
  1513. menuPattern    lea    Must(bp),a1        ; pattern
  1514.  
  1515. ;--------------------------------------------------------------------------
  1516.  
  1517. GetColor    tst.l    ColWin(bp)        ; already open ?
  1518.         bne.s    1$
  1519.         lea    0(a1,d1.w),a1        ; color entry
  1520.         move.l    a1,color(bp)
  1521.         lea    colwintab(pc),a0
  1522.         moveq    #0,d0            ; TAG_DONE
  1523.         move.l    d0,-(sp)
  1524.         move.b    BitMap1+5(bp),d0
  1525.         move.l    d0,-(sp)
  1526.         pea    $80080010        ; GTPA_Depth
  1527.         move.l    sp,-(sp)
  1528.         move.l    sp,a1            ; **ptr
  1529.         bsr    CreateRequest
  1530.         lea    16(sp),sp
  1531.         movem.l    d0/d1,ColWin(bp)    ; store window && gadgets
  1532. 1$        rts
  1533.  
  1534. ***************************************************************************
  1535.  
  1536. NewSize2    movem.l    d2/d3/a2/a6,-(sp)
  1537.         moveq    #2,d1            ; cmp value
  1538.         move.b    rahmenanz(bp),d0
  1539.         tst.b    hires(bp)
  1540.         beq.s    9$
  1541.         cmp.b    d1,d0
  1542.         bne.s    9$
  1543.         moveq    #4,d0
  1544. 9$        move.b    d0,BoLeft+3(bp)
  1545.         move.b    rahmenanz(bp),d0
  1546.         tst.b    interlace(bp)
  1547.         beq.s    8$
  1548.         cmp.b    d1,d0
  1549.         bne.s    8$
  1550.         moveq    #4,d0
  1551. 8$        move.b    d0,BoTop+3(bp)
  1552.         move.l    WinPtr(bp),a0
  1553.         move.w    8(a0),Breite+2(bp)    ; window->width
  1554.         move.w    10(a0),Hoehe+2(bp)    ; window->height
  1555.         move.l    BoLeft(bp),d0
  1556.         add.l    d0,d0
  1557.         sub.l    Breite(bp),d0
  1558.         neg.l    d0
  1559.         move.l    d0,Breit2(bp)        ; Breit2 = Breite-BoLeft<<1
  1560.         move.l    BoTop(bp),d0
  1561.         add.l    d0,d0
  1562.         sub.l    Hoehe(bp),d0
  1563.         neg.l    d0
  1564.         move.l    d0,Hoehe2(bp)        ; Hoehe2 = Hoehe-BoTop<<1
  1565.         moveq    #12,d2            ; cmp value
  1566.         moveq    #-2,d1            ; cmp value
  1567.         moveq    #0,d0
  1568.         cmp.w    xMask+2(bp),d1
  1569.         bne.s    7$
  1570.         cmp.l    Breit2(bp),d2
  1571.         bcc.s    7$            ; <= 12 !
  1572.         moveq    #1,d0
  1573. 7$        move.b    d0,xDouble(bp)        ; set value
  1574.         moveq    #0,d0
  1575.         cmp.w    yMask+2(bp),d1
  1576.         bne.s    6$
  1577.         cmp.l    Hoehe2(bp),d2
  1578.         bcc.s    6$            ; <= 12 !
  1579.         moveq    #1,d0
  1580. 6$        move.b    d0,yDouble(bp)        ; set value
  1581.         moveq    #0,d0
  1582.         moveq    #25,d1
  1583.         cmp.l    Breit2(bp),d1
  1584.         bcc.s    5$            ; <= 25 !
  1585.         moveq    #1,d0
  1586.         add.l    d1,d1
  1587.         cmp.l    Breit2(bp),d1
  1588.         bcc.s    5$            ; <= 50 !
  1589.         moveq    #2,d0
  1590. 5$        move.w    d0,xOffset(bp)        ; set value
  1591.         moveq    #0,d0
  1592.         moveq    #25,d1
  1593.         cmp.l    Hoehe2(bp),d1
  1594.         bcc.s    4$            ; <= 25 !
  1595.         moveq    #1,d0
  1596.         add.l    d1,d1
  1597.         cmp.l    Hoehe2(bp),d1
  1598.         bcc.s    4$            ; <= 50 !
  1599.         moveq    #2,d0
  1600. 4$        move.w    d0,yOffset(bp)        ; set value
  1601.         move.l    Breite(bp),d0
  1602.         move.l    Hoehe(bp),d1
  1603.         cmp.l    d1,d0
  1604.         bcs.s    3$
  1605.         move.l    d1,d0
  1606. 3$        asr.w    #3,d0
  1607.         cmp.w    GadSize(bp),d0
  1608.         beq.s    10$            ; don't update gadgets
  1609.         move.w    d0,GadSize(bp)
  1610.         move.l    WinPtr(bp),a0
  1611.         lea    GadgetBuf(bp),a1
  1612.         moveq    #-1,d0
  1613.         CALL    RemoveGList,IntBase(bp)    ; remove gadgets
  1614.         lea    sizes(pc),a0
  1615.         lea    GadgetBuf(bp),a1
  1616.         moveq    #3,d3
  1617. 2$        moveq    #3,d2
  1618.         moveq    #4,d1
  1619. 1$        move.b    (a0)+,d0
  1620.         ext.w    d0
  1621.         muls    GadSize(bp),d0
  1622.         move.w    d0,0(a1,d1.w)        ; set new positions
  1623.         addq.w    #2,d1
  1624.         dbra    d2,1$
  1625.         lea    44(a1),a1
  1626.         dbra    d3,2$
  1627.         move.l    WinPtr(bp),a0
  1628.         lea    GadgetBuf(bp),a1
  1629.         moveq    #0,d0
  1630.         moveq    #4,d1
  1631.         moveq    #0,d2
  1632.         RECALL    AddGList        ; add gadgets again
  1633. 10$        lea    RPort2(bp),a1
  1634.         CALL    InitRastPort,GfxBase(bp)
  1635.         moveq    #0,d0
  1636.         move.l    PubScreen(bp),a0
  1637.         move.b    189(a0),d0        ; BitMap.Depth
  1638.         move.l    Breit2(bp),d1
  1639.         move.l    Hoehe2(bp),d2
  1640.         lea    BitMap1(bp),a0
  1641.         RECALL    InitBitMap
  1642.         lea    BitMap1+8(bp),a2
  1643.         move.b    BitMap1+5(bp),d2
  1644. 11$        move.l    Breit2(bp),d0
  1645.         move.l    Hoehe2(bp),d1
  1646.         RECALL    AllocRaster
  1647.         move.l    d0,(a2)+
  1648.         beq.s    12$            ; error no mem !
  1649.         subq.b    #1,d2
  1650.         bne.s    11$
  1651.         lea    BitMap1(bp),a0
  1652.         move.l    a0,RPort2+4(bp)        ; RastPort.BitMap = BitMap
  1653.         move.l    Breit2(bp),d0
  1654.         move.l    Hoehe2(bp),d1
  1655.         RECALL    AllocRaster
  1656.         move.l    d0,a1
  1657.         move.l    a1,Buf(bp)
  1658.         beq.s    12$            ; no bitplane !
  1659.         lea    TempRas(bp),a0
  1660.         moveq    #15,d1            ; RASSIZE(Breite,Hoehe)
  1661.         add.w    Breit2+2(bp),d1
  1662.         asr.w    #3,d1
  1663.         moveq    #-2,d0
  1664.         and.w    d1,d0
  1665.         mulu    Hoehe2+2(bp),d0
  1666.         RECALL    InitTmpRas
  1667.         move.l    d0,RPort2+12(bp)    ; RastPort.TmpRas = TempRas
  1668.         lea    AreaInf(bp),a0
  1669.         lea    Table(bp),a1
  1670.         moveq    #5,d0
  1671.         RECALL    InitArea
  1672.         lea    AreaInf(bp),a0
  1673.         move.l    a0,RPort2+16(bp)    ; RastPort.AreaInfo = AreaInf
  1674. 12$        movem.l    (sp)+,d2/d3/a2/a6
  1675.         rts
  1676.  
  1677. ;--------------------------------------------------------------------------
  1678.  
  1679. NextTick    movem.l    d2/d3/d4/a2/a6,-(sp)
  1680.         move.l    TimerIO(bp),a2
  1681.         lea    32(a2),a0
  1682.         CALL    GetSysTime,20(a2)
  1683.         move.l    32(a2),d2
  1684.         move.l    #1100000,d0
  1685.         sub.l    36(a2),d0
  1686.         move.l    d0,36(a2)        ; tv_micro
  1687.         moveq    #0,d0
  1688.         tst.b    sekunden(bp)
  1689.         bne.s    1$
  1690.         move.l    d2,d0
  1691.         moveq    #60,d1
  1692.         bsr    LDiv            ; sec = 59-sec%60
  1693.         moveq    #59,d0
  1694.         sub.l    d1,d0
  1695. 1$        move.l    d0,32(a2)        ; tv_secs
  1696.         move.w    #9,28(a2)
  1697.         move.l    a2,a1
  1698.         CALL    SendIO,SysBase(bp)    ; TR_ADDREQUEST
  1699.         st    TimerSent(bp)
  1700.         move.w    min(bp),d4        ; oldmin
  1701.         move.l    d2,d0
  1702.         moveq    #60,d1
  1703.         bsr    LDiv            ; min = sec/60
  1704.         exg.l    d0,d2
  1705.         moveq    #60,d1
  1706.         bsr    LDiv            ; sec = sec%60
  1707.         move.w    d1,sec(bp)
  1708.         move.l    d2,d0
  1709.         moveq    #12,d1
  1710.         bsr    LDiv            ; std = min/12
  1711.         move.l    d0,d3
  1712.         move.l    d2,d0
  1713.         moveq    #60,d1
  1714.         bsr    LDiv            ; min = min%60
  1715.         move.w    d1,min(bp)
  1716.         move.l    d3,d0
  1717.         moveq    #60,d1
  1718.         bsr    LDiv            ; std = std%60
  1719.         move.w    d1,std(bp)
  1720.         move.w    min(bp),d0
  1721.         sub.w    d4,d0            ; oldmin != min
  1722.         movem.l    (sp)+,d2/d3/d4/a2/a6
  1723.         rts
  1724.  
  1725. ;--------------------------------------------------------------------------
  1726.  
  1727. SetAPen        ext.w    d0            ; set pen
  1728.         ext.l    d0
  1729.         move.l    a2,a1
  1730.         jmp    _LVOSetAPen(a6)
  1731.  
  1732. Move        move.l    a2,a1            ; moveto
  1733.         jmp    _LVOMove(a6)
  1734.  
  1735. Draw        move.l    a2,a1            ; drawto
  1736.         jmp    _LVODraw(a6)
  1737.  
  1738. Rahmen        movem.l    d2-d7/a2/a6,-(sp)
  1739.         move.l    GfxBase(bp),a6        ; setup regs
  1740.         move.l    RPort1(bp),a2
  1741.         move.l    Breite(bp),d4
  1742.         move.l    Hoehe(bp),d5
  1743.         move.b    rahmenanz(bp),d7
  1744.         beq    1$            ; no border ...
  1745.         move.b    Pens+11(bp),d2
  1746.         move.b    Pens+12(bp),d3
  1747.         tst.b    Active(bp)
  1748.         beq.s    4$
  1749.         cmpi.b    #1,d7            ; rahmenanz
  1750.         bne.s    4$
  1751.         exg.l    d2,d3
  1752. 4$        move.b    d2,d0
  1753.         bsr.s    SetAPen            ; SetAPen(rp,a?b:c);
  1754.         moveq    #1,d0
  1755.         moveq    #-1,d1
  1756.         add.l    d5,d1
  1757.         bsr.s    Move            ; Move(rp,1,hoehe-1);
  1758.         moveq    #-1,d0
  1759.         add.l    d4,d0
  1760.         moveq    #-1,d1
  1761.         add.l    d5,d1
  1762.         bsr.s    Draw            ; Draw(rp,breite-1,hoehe-1);
  1763.         moveq    #-1,d0
  1764.         add.l    d4,d0
  1765.         moveq    #1,d1
  1766.         bsr.s    Draw            ; Draw(rp,breite-1,1);
  1767.         move.b    d3,d0
  1768.         bsr.s    SetAPen            ; SetAPen(rp,a?c:b);
  1769.         moveq    #0,d0
  1770.         moveq    #-1,d1
  1771.         add.l    d5,d1
  1772.         bsr.s    Move            ; Move(rp,0,hoehe-1);
  1773.         moveq    #0,d0
  1774.         moveq    #0,d1
  1775.         bsr.s    Draw            ; Draw(rp,0,0);
  1776.         moveq    #-1,d0
  1777.         add.l    d4,d0
  1778.         moveq    #0,d1
  1779.         bsr.s    Draw            ; Draw(rp,breite-1,0);
  1780.         cmpi.b    #2,d7
  1781.         bne    1$
  1782.         move.l    BoLeft(bp),d6
  1783.         move.l    BoTop(bp),d7
  1784.         move.b    Pens+12(bp),d0
  1785.         bsr    SetAPen            ; SetAPen(rp,pens[12]);
  1786.         move.l    d6,d0
  1787.         move.l    d5,d1
  1788.         sub.l    d7,d1
  1789.         bsr    Move            ; Move(rp,boleft,hoehe-botop);
  1790.         move.l    d4,d0
  1791.         sub.l    d6,d0
  1792.         move.l    d5,d1
  1793.         sub.l    d7,d1
  1794.         bsr    Draw            ; Draw(rp,breite-boleft,hoehe-botop);
  1795.         move.l    d4,d0
  1796.         sub.l    d6,d0
  1797.         move.l    d7,d1
  1798.         bsr    Draw            ; Draw(rp,breite-boleft,botop);
  1799.         move.b    Pens+11(bp),d0
  1800.         bsr    SetAPen
  1801.         moveq    #-1,d0
  1802.         add.l    d6,d0
  1803.         move.l    d5,d1
  1804.         sub.l    d7,d1
  1805.         bsr    Move            ; Move(rp,boleft-1,hoehe-botop);
  1806.         moveq    #-1,d0
  1807.         add.l    d6,d0
  1808.         moveq    #-1,d1
  1809.         add.l    d7,d1
  1810.         bsr    Draw            ; Draw(rp,boleft-1,botop-1);
  1811.         move.l    d4,d0
  1812.         sub.l    d6,d0
  1813.         moveq    #-1,d1
  1814.         add.l    d7,d1
  1815.         bsr    Draw            ; Draw(rp,breite-boleft,botop-1);
  1816.         move.b    Pens+10(bp),d0
  1817.         tst.b    Active(bp)
  1818.         beq.s    3$            ; window not active 
  1819.         move.b    Pens+13(bp),d0
  1820. 3$        bsr    SetAPen
  1821.         tst.b    hires(bp)
  1822.         beq.s    2$
  1823.         moveq    #1,d0
  1824.         moveq    #1,d1
  1825.         moveq    #2,d2
  1826.         moveq    #-2,d3
  1827.         add.l    d5,d3
  1828.         bsr.s    RectFill        ; RectFill(rp,1,1,2,hoehe-2);
  1829.         moveq    #-3,d0
  1830.         add.l    d4,d0
  1831.         moveq    #1,d1
  1832.         moveq    #-2,d2
  1833.         add.l    d4,d2
  1834.         moveq    #-2,d3
  1835.         add.l    d5,d3
  1836.         bsr.s    RectFill        ; RectFill(rp,breite-3,1,breite-2,hoehe-2);
  1837. 2$        tst.b    interlace(bp)
  1838.         beq.s    1$
  1839.         moveq    #1,d0
  1840.         moveq    #1,d1
  1841.         moveq    #-2,d2
  1842.         add.l    d4,d2
  1843.         moveq    #2,d3
  1844.         bsr.s    RectFill        ; RectFill(rp,1,1,breite-2,2);
  1845.         moveq    #1,d0
  1846.         moveq    #-3,d1
  1847.         add.l    d5,d1
  1848.         moveq    #-2,d2
  1849.         add.l    d4,d2
  1850.         moveq    #-2,d3
  1851.         add.l    d5,d3
  1852.         bsr.s    RectFill        ; RectFill(rp,1,hoehe-3,breite-2,hoehe-2);
  1853. 1$        move.b    Pens+0(bp),d0
  1854.         bsr    SetAPen            ; SetAPen(rp,pens[0]);
  1855.         movem.l    (sp)+,d2-d7/a2/a6
  1856.         rts
  1857.  
  1858. RectFill    move.l    a2,a1            ; fill rectangle
  1859.         jmp    _LVORectFill(a6)
  1860.  
  1861. ;--------------------------------------------------------------------------
  1862.  
  1863. ZifferBlatt    movem.l    d2-d7/a2/a3/a6,-(sp)
  1864.         subq.w    #8,sp            ; local vars
  1865.         move.l    GfxBase(bp),a6
  1866.         lea    RPort2(bp),a2
  1867.         move.l    Breit2(bp),d4
  1868.         move.l    Hoehe2(bp),d5
  1869.         tst.l    ImgBitMap(bp)
  1870.         beq.s    11$
  1871.         tst.b    useimage(bp)
  1872.         beq.s    11$
  1873.         bsr    CopyTiledBitMap
  1874.         bra.s    10$
  1875. 11$        andi.w    #$fff7,32(a2)        ; BNDRYOFF(RastPort);
  1876.         moveq    #-1,d0
  1877.         bsr    SetAPen
  1878.         lea    Muster(bp),a0        ; SetAfPt(RastPort,Muster,Anz);
  1879.         move.l    a0,8(a2)
  1880.         st    29(a2)
  1881.         moveq    #0,d0
  1882.         moveq    #0,d1
  1883.         moveq    #-1,d2
  1884.         add.l    d4,d2
  1885.         moveq    #-1,d3
  1886.         add.l    d5,d3
  1887.         bsr    RectFill        ; RectFill(RastPort,0,0,Breit2-1,Hoehe2-1);
  1888.         clr.l    8(a2)            ; SetAfPt(RastPort,0,0);
  1889.         clr.b    29(a2)
  1890. 10$        moveq    #1,d6            ; a=(zeigen>1?(zeigen==3?60:15):(zeigen?5:1));
  1891.         move.b    zeigen(bp),d0
  1892.         beq.s    9$
  1893.         moveq    #5,d6
  1894.         cmpi.b    #1,d0
  1895.         beq.s    9$
  1896.         moveq    #15,d6
  1897.         cmpi.b    #3,d0
  1898.         bne.s    9$
  1899.         moveq    #60,d6
  1900. 9$        cmpi.b    #4,d0
  1901.         bcc    2$            ; zeigen >= 4 !
  1902.         moveq    #0,d7
  1903. 8$        lea    srect(pc),a3
  1904.         tst.b    oval(bp)
  1905.         beq.s    7$
  1906.         lea    sinus(pc),a3
  1907. 7$        move.l    d4,d2
  1908.         asr.l    #1,d2
  1909.         move.b    0(a3,d7.w),d0
  1910.         ext.w    d0
  1911.         muls    d4,d0
  1912.         divs    #300,d0
  1913.         and.l    xMask(bp),d0
  1914.         add.l    d0,d2            ; x=x0+(array[i]*Breit2/300)&xMask
  1915.         move.l    d5,d3
  1916.         asr.l    #1,d3
  1917.         move.b    60(a3,d7.w),d0
  1918.         ext.w    d0
  1919.         muls    d5,d0
  1920.         divs    #300,d0
  1921.         and.l    yMask(bp),d0
  1922.         sub.l    d0,d3            ; y=y0-(array[i]*Hoehe2/300)&yMask
  1923.         move.l    d7,d0            ; if (i%5) { draw minute }
  1924.         divu    #5,d0
  1925.         swap    d0
  1926.         tst.w    d0
  1927.         beq    5$
  1928.         subq.w    #1,d0            ; if (i%5==1)
  1929.         bne.s    6$
  1930.         move.b    Pens+9(bp),d0
  1931.         bsr    SetPens            ; set apen + open
  1932. 6$        move.l    d4,d0
  1933.         moveq    #100,d1
  1934.         add.w    d1,d1
  1935.         bsr    LDiv
  1936.         move.l    d0,0(sp)        ; Breit2/200
  1937.         move.l    d5,d0
  1938.         moveq    #100,d1
  1939.         add.w    d1,d1
  1940.         bsr    LDiv
  1941.         move.l    d0,4(sp)        ; Hoehe2/200
  1942.         move.l    d2,d0
  1943.         add.l    0(sp),d0
  1944.         move.l    d3,d1
  1945.         bsr    AreaMove
  1946.         move.l    d2,d0
  1947.         move.l    d3,d1
  1948.         add.l    4(sp),d1
  1949.         bsr    AreaDraw
  1950.         move.l    d2,d0
  1951.         sub.l    0(sp),d0
  1952.         move.l    d3,d1
  1953.         bsr    AreaDraw
  1954.         move.l    d2,d0
  1955.         move.l    d3,d1
  1956.         sub.l    4(sp),d1
  1957.         bsr    AreaDraw
  1958.         bra.s    4$
  1959. 5$        swap    d0            ; else { draw hour }
  1960.         lea    dx1(pc),a3
  1961.         lea    0(a3,d0.w),a3        ; calc table entry
  1962.         lea    pent(pc),a0
  1963.         move.b    0(a0,d0.w),d0
  1964.         lea    Pens(bp),a0
  1965.         move.b    0(a0,d0.w),d0
  1966.         bsr    SetPens            ; set apen + open
  1967.         bsr    MoveHour
  1968.         bsr    DrawHour
  1969.         bsr    DrawHour
  1970.         bsr    DrawHour
  1971. 4$        bsr    AreaEnd
  1972.         add.l    d6,d7
  1973.         moveq    #59,d0
  1974.         cmp.l    d7,d0
  1975.         bcc    8$            ; not ready
  1976. 2$        tst.b    schatten(bp)
  1977.         beq.s    1$
  1978.         move.w    std(bp),0(sp)
  1979.         move.w    #440,2(sp)
  1980.         move.b    Pens+5(bp),d0        ; apen && open
  1981.         move.b    d0,4(sp)
  1982.         move.b    d0,5(sp)
  1983.         st    6(sp)
  1984.         bsr    Zeiger
  1985.         move.w    min(bp),0(sp)
  1986.         move.w    #300,2(sp)
  1987.         bsr    Zeiger
  1988. 1$        move.w    std(bp),0(sp)
  1989.         move.w    #440,2(sp)
  1990.         move.b    Pens+3(bp),4(sp)    ; apen && open
  1991.         move.b    Pens+4(bp),5(sp)
  1992.         clr.b    6(sp)
  1993.         bsr    Zeiger
  1994.         move.w    min(bp),0(sp)
  1995.         move.w    #300,2(sp)
  1996.         move.b    Pens+1(bp),4(sp)
  1997.         move.b    Pens+2(bp),5(sp)
  1998.         bsr    Zeiger
  1999.         move.l    BoLeft(bp),d0        ; set redraw stuff
  2000.         move.l    d0,ReDrawx1(bp)
  2001.         move.l    BoTop(bp),d1
  2002.         move.l    d1,ReDrawy1(bp)
  2003.         add.l    Breit2(bp),d0
  2004.         subq.l    #1,d0
  2005.         move.l    d0,ReDrawx2(bp)
  2006.         add.l    Hoehe2(bp),d1
  2007.         subq.l    #1,d1
  2008.         move.l    d1,ReDrawy2(bp)
  2009.         addq.w    #8,sp
  2010.         movem.l    (sp)+,d2-d7/a2/a3/a6
  2011.         rts
  2012.  
  2013. MoveHour    bsr.s    SetNewXY        ; move hour pos
  2014.         move.l    d2,d0
  2015.         move.l    d3,d1
  2016.  
  2017. AreaMove    move.l    a2,a1            ; area move stub
  2018.         jmp    _LVOAreaMove(a6)
  2019.  
  2020. DrawHour    lea    24(a3),a3        ; draw a hour
  2021.         bsr.s    SetNewXY
  2022.         move.l    d2,d0
  2023.         move.l    d3,d1
  2024.  
  2025. AreaDraw    move.l    a2,a1            ; area draw stub
  2026.         jmp    _LVOAreaDraw(a6)
  2027.  
  2028. AreaEnd        move.l    a2,a1            ; area end stub
  2029.         jmp    _LVOAreaEnd(a6)
  2030.  
  2031. SetNewXY    moveq    #100,d1            ; update x && y
  2032.         move.b    0(a3),d0
  2033.         ext.w    d0
  2034.         muls    d4,d0
  2035.         divs    d1,d0
  2036.         add.w    d0,d2            ; x+=Breit2*dx?[b]/100
  2037.         move.b    12(a3),d0
  2038.         ext.w    d0
  2039.         muls    d5,d0
  2040.         divs    d1,d0
  2041.         add.w    d0,d3            ; y+=Hoehe2*dy?[b]/100
  2042.         rts
  2043.  
  2044. SetPens        move.l    d0,-(sp)        ; save pen number
  2045.         bsr    SetAPen
  2046.         move.l    (sp)+,d0
  2047.  
  2048. SetOPen        cmpi.w    #39,20(a6)        ; SetOPen v39+
  2049.         bcs.s    1$
  2050.         ext.w    d0
  2051.         ext.l    d0
  2052.         move.l    a2,a0
  2053.         jmp    _LVOSetOutlinePen(a6)
  2054. 1$        move.b    d0,27(a2)        ; SetOPen pre v39+
  2055.         or.w    #8,32(a2)
  2056.         rts
  2057.  
  2058. ;--------------------------------------------------------------------------
  2059.  
  2060. Zeiger        lea    4(sp),a0        ; get structure start
  2061.         movem.l    d2-d7/a2/a3/a6,-(sp)
  2062.         move.l    GfxBase(bp),a6
  2063.         move.l    a0,a3            ; save struct ptr
  2064.         lea    RPort2(bp),a2
  2065.         move.l    Breit2(bp),d2
  2066.         move.l    Hoehe2(bp),d3
  2067.         lea    handwidth(pc),a1
  2068.         moveq    #0,d1
  2069.         move.b    zeigerbreite(bp),d1
  2070.         add.w    d1,d1
  2071.         move.w    0(a1,d1.w),d1
  2072.         lea    sinus(pc),a0
  2073.         adda.w    0(a3),a0
  2074.         move.b    60(a0),d7        ; y2
  2075.         ext.w    d7
  2076.         muls    d3,d7
  2077.         divs    2(a3),d7
  2078.         ext.l    d7
  2079.         move.b    0(a0),d6        ; x2
  2080.         ext.w    d6
  2081.         muls    d2,d6
  2082.         divs    2(a3),d6
  2083.         ext.l    d6
  2084.         move.b    0(a0),d5        ; y1
  2085.         ext.w    d5
  2086.         muls    d3,d5
  2087.         divs    d1,d5
  2088.         ext.l    d5
  2089.         move.b    60(a0),d4        ; x1
  2090.         ext.w    d4
  2091.         muls    d2,d4
  2092.         divs    d1,d4
  2093.         ext.l    d4
  2094.         asr.l    #1,d3            ; y0
  2095.         asr.l    #1,d2            , x0
  2096.         tst.b    6(a3)
  2097.         beq.s    1$
  2098.         add.w    yOffset(bp),d3
  2099.         add.w    xOffset(bp),d2
  2100. 1$        move.b    4(a3),d0
  2101.         bsr    SetAPen
  2102.         move.b    5(a3),d0
  2103.         bsr    SetOPen
  2104.         bsr.s    DrawHand
  2105.         movem.l    (sp)+,d2-d7/a2/a3/a6
  2106.         rts
  2107.  
  2108. DrawHand    moveq    #0,d0
  2109.         move.b    zeigertyp(bp),d0
  2110.         beq.s    1$
  2111.         pea    AreaEnd(pc)        ; last area cmd
  2112.         add.w    d0,d0
  2113. 1$        move.w    ZeigerTab(pc,d0.w),d0
  2114.         jmp    ZeigerTab(pc,d0.w)
  2115.  
  2116. ZeigerTab    ADDCMD    Zeiger,0,0        ; CASE line
  2117.         ADDCMD    Zeiger,1        ; case triangle
  2118.         ADDCMD    Zeiger,2        ; case rhombus
  2119.         ADDCMD    Zeiger,3        ; case rectangle
  2120.  
  2121. Zeiger0        move.b    5(a3),d0
  2122.         bsr    SetAPen            ; SetAPen(rp,open)
  2123.         move.l    d2,d0
  2124.         move.l    d3,d1
  2125.         bsr    Move            ; Move(rp,x0,y0)
  2126.         move.l    d2,d0
  2127.         add.l    d6,d0
  2128.         move.l    d3,d1
  2129.         sub.l    d7,d1
  2130.         bsr    Draw            ; Draw(rp,x0+x2,y0-y2)
  2131.         tst.b    xDouble(bp)
  2132.         beq.s    2$
  2133.         moveq    #1,d0
  2134.         add.l    d2,d0
  2135.         move.l    d3,d1
  2136.         bsr    Move            ; Move(rp,x0+1,y0)
  2137.         moveq    #1,d0
  2138.         add.l    d2,d0
  2139.         add.l    d6,d0
  2140.         move.l    d3,d1
  2141.         sub.l    d7,d1
  2142.         bsr    Draw            ; Draw(rp,x0+x2+1,y0-y2)
  2143. 2$        tst.b    yDouble(bp)
  2144.         beq.s    1$
  2145.         move.l    d2,d0
  2146.         moveq    #1,d1
  2147.         add.l    d3,d1
  2148.         bsr    Move            ; Move(rp,x0,y0+1)
  2149.         move.l    d2,d0
  2150.         add.l    d6,d0
  2151.         moveq    #1,d1
  2152.         add.l    d3,d1
  2153.         sub.l    d7,d1
  2154.         bsr    Draw            ; Draw(rp,x0+x2,y0-y2+1)
  2155. 1$        rts
  2156.  
  2157. Zeiger1        move.l    d2,d0
  2158.         add.l    d6,d0
  2159.         move.l    d3,d1
  2160.         sub.l    d7,d1
  2161.         bsr    AreaMove        ; AreMove(rp,x0+x2,y0-y2);
  2162.         move.l    d6,d0
  2163.         asr.l    #2,d0
  2164.         neg.l    d0
  2165.         add.l    d4,d0
  2166.         add.l    d2,d0
  2167.         move.l    d7,d1
  2168.         asr.l    #2,d1
  2169.         add.l    d5,d1
  2170.         add.l    d3,d1
  2171.         bsr    AreaDraw        ; AreaMove(rp,x0+x1-x2/4,y0+y1+y2/4);
  2172.         move.l    d6,d0
  2173.         asr.l    #2,d0
  2174.         neg.l    d0
  2175.         sub.l    d4,d0
  2176.         add.l    d2,d0
  2177.         move.l    d7,d1
  2178.         asr.l    #2,d1
  2179.         sub.l    d5,d1
  2180.         add.l    d3,d1
  2181.         bra    AreaDraw        ; AreaDraw(rp,x0-x1-x2/4,y0-y1+y2/4);
  2182.  
  2183. Zeiger2        move.l    d2,d0
  2184.         add.l    d6,d0
  2185.         move.l    d3,d1
  2186.         sub.l    d7,d1
  2187.         bsr    AreaMove        ; AreMove(rp,x0+x2,y0-y2);
  2188.         move.l    d2,d0
  2189.         add.l    d4,d0
  2190.         move.l    d3,d1
  2191.         add.l    d5,d1
  2192.         bsr    AreaDraw        ; AreaDraw(rp,x0+x1,y0+y1);
  2193.         move.l    d6,d0
  2194.         asr.l    #2,d0
  2195.         neg.l    d0
  2196.         add.l    d2,d0
  2197.         move.l    d7,d1
  2198.         asr.l    #2,d1
  2199.         add.l    d3,d1
  2200.         bsr    AreaDraw        ; AreaDraw(rp,x0-x2/4,y0+y2/4);
  2201. ;        move.l    d2,d0
  2202. ;        sub.l    d4,d0
  2203. ;        move.l    d3,d1
  2204. ;        sub.l    d5,d1
  2205. ;        bra    AreaDraw        ; AreaDraw(rp,x0-x1,y0-y1);
  2206.         bra.s    Zeiger23
  2207.  
  2208. Zeiger3        move.l    d4,d0
  2209.         asr.l    #1,d0
  2210.         sub.l    d0,d2
  2211.         add.l    d6,d2
  2212.         move.l    d2,d0
  2213.         move.l    d5,d1
  2214.         asr.l    #1,d1
  2215.         add.l    d7,d1
  2216.         sub.l    d1,d3
  2217.         move.l    d3,d1
  2218.         bsr    AreaMove        ; AreMove(rp,x0+=x2-x1/2,y0-=y2+y1/2);
  2219.         add.l    d4,d2
  2220.         move.l    d2,d0
  2221.         add.l    d5,d3
  2222.         move.l    d3,d1
  2223.         bsr    AreaDraw        ; AreaDraw(rp,x0+=x1,y0+=y1);
  2224.         move.l    d6,d0
  2225.         asl.l    #2,d0
  2226.         add.l    d6,d0
  2227.         asr.l    #2,d0
  2228.         sub.l    d0,d2
  2229.         move.l    d2,d0
  2230.         move.l    d7,d1
  2231.         asl.l    #2,d1
  2232.         add.l    d7,d1
  2233.         asr.l    #2,d1
  2234.         add.l    d1,d3
  2235.         move.l    d3,d1
  2236.         bsr    AreaDraw        ; AreaDraw(rp,x0-=x2*5/4,y0+=y2*5/4);
  2237. Zeiger23    sub.l    d4,d2
  2238.         move.l    d2,d0
  2239.         sub.l    d5,d3
  2240.         move.l    d3,d1
  2241.         bra    AreaDraw        ; AreaDraw(rp,x0-=x1,y0-=y1);
  2242.  
  2243. ;--------------------------------------------------------------------------
  2244.  
  2245. Zeichnen    movem.l    d2-d7/a2/a6,-(sp)
  2246.         move.l    GfxBase(bp),a6
  2247.         move.l    RPort1(bp),a2
  2248.         move.l    a2,a1            ; RastPort
  2249.         lea    BitMap1(bp),a0        ; BitMap
  2250.         move.l    ReDrawx1(bp),d0
  2251.         move.l    d0,d2
  2252.         sub.l    BoLeft(bp),d0        ; redrawx1-boleft
  2253.         move.l    ReDrawy1(bp),d1
  2254.         move.l    d1,d3
  2255.         sub.l    BoTop(bp),d1        ; redrawy1-botop
  2256.         move.l    ReDrawx2(bp),d4
  2257.         sub.l    d2,d4
  2258.         addq.l    #1,d4            ; redrawx2-redrawx1+1
  2259.         move.l    ReDrawy2(bp),d5
  2260.         sub.l    d3,d5
  2261.         addq.l    #1,d5            ; redrawy2-redrawy1+1
  2262.         moveq    #256-$c0,d6
  2263.         neg.b    d6
  2264.         RECALL    BltBitMapRastPort
  2265.         tst.b    sekunden(bp)
  2266.         beq    1$
  2267.         move.l    Breite(bp),d2
  2268.         asr.l    #1,d2            ; redrawx1/2
  2269.         move.l    Hoehe(bp),d3
  2270.         asr.l    #1,d3            ; redrawy1/2
  2271.         lea    sinus(pc),a0
  2272.         add.w    sec(bp),a0
  2273.         move.b    0(a0),d4
  2274.         ext.w    d4
  2275.         muls    Breit2+2(bp),d4
  2276.         divs    #300,d4
  2277.         ext.l    d4
  2278.         add.l    d2,d4            ; redrawx2=redrawx1+sinus[sec]*Breit2/300;
  2279.         move.b    60(a0),d5
  2280.         ext.w    d5
  2281.         muls    Hoehe2+2(bp),d5
  2282.         divs    #300,d5
  2283.         ext.l    d5
  2284.         neg.l    d5
  2285.         add.l    d3,d5            ; redrawy2=redrawy1+cosinus[sec]*Hoehe2/300;
  2286.         move.l    d2,d0
  2287.         move.l    d3,d1
  2288.         bsr    Move            ; Move(rp,redrawx1,redrawy1);
  2289.         move.l    d4,d0
  2290.         move.l    d5,d1
  2291.         bsr    Draw            ; Draw(rp,redrawx2,redrawy2);
  2292.         move.b    xDouble(bp),d6        ; if (doublex)
  2293.         beq.s    7$
  2294.         moveq    #1,d0
  2295.         add.l    d2,d0
  2296.         move.l    d3,d1
  2297.         bsr    Move            ; Move(rp,redrawx1+1,redrawy1);
  2298.         moveq    #1,d0
  2299.         add.l    d4,d0
  2300.         move.l    d5,d1
  2301.         bsr    Draw            ; Draw(rp,redrawx2+1,redrawy2);
  2302. 7$        move.b    yDouble(bp),d7        ; if (doubley)
  2303.         beq.s    6$
  2304.         move.l    d2,d0
  2305.         moveq    #1,d1
  2306.         add.l    d3,d1
  2307.         bsr    Move            ; Move(rp,redrawx1,redrawy1+1);
  2308.         move.l    d4,d0
  2309.         moveq    #1,d1
  2310.         add.l    d5,d1
  2311.         bsr    Draw            ; Draw(rp,redrawx2,redrawy2+1);
  2312. 6$        cmp.l    d2,d4            ; if (redrawx1 > redrawx2)
  2313.         bcc.s    5$
  2314.         exg.l    d2,d4            ; redrawx1 <-> redrawx2
  2315. 5$        tst.b    d6            ; if (doublex)
  2316.         beq.s    4$
  2317.         addq.l    #1,d4            ; redrawx2++;
  2318. 4$        move.l    d2,ReDrawx1(bp)
  2319.         move.l    d4,ReDrawx2(bp)
  2320.         cmp.l    d3,d5            ; if (redrawy1 > redrawy2)
  2321.         bcc.s    3$
  2322.         exg.l    d3,d5            ; redrawy1 <-> redrawy2
  2323. 3$        tst.b    d7            ; if (doubley)
  2324.         beq.s    2$
  2325.         addq.l    #1,d5            ; redrawy2++
  2326. 2$        move.l    d3,ReDrawy1(bp)
  2327.         move.l    d5,ReDrawy2(bp)
  2328. 1$        moveq    #1,d0            ; all ok (for flags!)
  2329.         movem.l    (sp)+,d2-d7/a2/a6
  2330.         rts
  2331.  
  2332. ***************************************************************************
  2333.  
  2334. SetPattern    movem.l    d2-d7,-(sp)
  2335.         move.w    #$5555,d2
  2336.         move.w    #$aaaa,d3
  2337.         lea    Must(bp),a0
  2338.         move.b    (a0)+,d4        ; a
  2339.         move.b    (a0)+,d5        ; b
  2340.         move.b    (a0)+,d6        ; c
  2341.         move.b    (a0),d7            ; d
  2342.         moveq    #-2,d0            ; if (a!=b || c!=d)
  2343.         cmp.b    d4,d5
  2344.         bne.s    5$
  2345.         cmp.b    d6,d7
  2346.         bne.s    5$
  2347.         moveq    #-1,d0            ; if (a==b && c==d)
  2348. 5$        move.w    d0,xMask+2(bp)
  2349.         moveq    #-2,d0            ; if (a!=c || b!=d)
  2350.         cmp.b    d4,d6
  2351.         bne.s    4$
  2352.         cmp.b    d5,d7
  2353.         bne.s    4$
  2354.         moveq    #-1,d0            ; if (a==c && b==d)
  2355. 4$        move.w    d0,yMask+2(bp)
  2356.         lea    Muster(bp),a0
  2357.         moveq    #0,d1
  2358. 3$        btst    d1,d4            ; (a&1<<i?0x5555:0)
  2359.         sne    d0
  2360.         ext.w    d0
  2361.         and.w    d2,d0
  2362.         btst    d1,d5            ; (b&1<<i?0xaaaa:0)
  2363.         beq.s    2$
  2364.         or.w    d3,d0
  2365. 2$        move.w    d0,(a0)+        ; Muster[i][0]
  2366.         btst    d1,d6            ; (c&1<<i?0x5555:0)
  2367.         sne    d0
  2368.         ext.w    d0
  2369.         and.w    d2,d0
  2370.         btst    d1,d7            ; (d&1<<i?0xaaaa:0)
  2371.         beq.s    1$
  2372.         or.w    d3,d0
  2373. 1$        move.w    d0,(a0)+        ; Muster[i][1]
  2374.         addq.w    #1,d1
  2375.         cmpi.w    #8,d1
  2376.         bcs.s    3$            ; for (i=0;i<8;i++)
  2377.         movem.l    (sp)+,d2-d7
  2378.         rts
  2379.  
  2380. ***************************************************************************
  2381.  
  2382. settingsSave    movem.l    d2-d7/a2/a3/a6,-(sp)
  2383.         move.l    PrgArg+0(bp),d1
  2384.         CALL    CurrentDir,DosBase(bp)
  2385.         move.l    d0,d4
  2386.         move.l    PrgArg+4(bp),a0
  2387.         CALL    GetDiskObjectNew,IconBase(bp)
  2388.         move.l    d0,d7
  2389.         beq    1$
  2390.         moveq    #(((tt_Num*40)+15)&$fff0)>>4,d6
  2391.         lsl.w    #4,d6
  2392.         move.l    d7,a1
  2393.         move.l    54(a1),d1
  2394.         move.l    d1,a1
  2395. 16$        tst.l    (a1)+
  2396.         bne.s    16$
  2397.         sub.l    d1,a1
  2398.         add.l    d6,a1
  2399.         moveq    #tt_Num*4,d0
  2400.         add.l    a1,d0
  2401.         moveq    #0,d1
  2402.         CALL    AllocVec,SysBase(bp)
  2403.         move.l    d0,d5
  2404.         beq    2$            ; no buffer for ptr && tooltypes
  2405.         add.l    d5,d6
  2406.         move.l    d7,a0
  2407.         move.l    54(a0),a0
  2408.         move.l    d6,a1
  2409. 15$        move.l    (a0)+,(a1)+        ; copy ptrs to tooltypes
  2410.         bne.s    15$
  2411.         move.l    IconBase(bp),a6
  2412.         moveq    #0,d2
  2413. 14$        move.l    d2,d0
  2414.         bsr    GetToolType
  2415.         move.l    a0,a3
  2416.         move.l    d6,a0
  2417.         move.l    a3,a1
  2418.         RECALL    FindToolType
  2419.         tst.l    d0
  2420.         beq.s    11$
  2421.         move.l    d6,a2
  2422. 13$        addq.w    #4,a2
  2423.         tst.l    0(a2)
  2424.         beq.s    12$
  2425.         move.l    a2,a0
  2426.         move.l    a3,a1
  2427.         RECALL    FindToolType
  2428.         tst.l    d0
  2429.         bne.s    13$
  2430. 12$        move.l    (a2)+,-8(a2)        ; remove ptr to tooltype
  2431.         bne.s    12$
  2432. 11$        addq.w    #1,d2
  2433.         cmpi.w    #tt_Num,d2
  2434.         bcs.s    14$
  2435.         lea    fmt1(pc),a0
  2436.         move.l    a0,d2            ; format string
  2437.         move.l    d6,a2
  2438. 10$        tst.l    (a2)+
  2439.         bne.s    10$
  2440.         subq.w    #4,a2            ; ttypes[k]
  2441.         move.l    d5,a3            ; buffer for sprintf
  2442.         moveq    #0,d0            ; TOP
  2443.         move.l    WinPtr(bp),a1
  2444.         moveq    #0,d1
  2445.         move.w    6(a1),d1        ; window->TopEdge
  2446.         bsr    SetToolType
  2447.         moveq    #1,d0            ; LEFT
  2448.         move.l    WinPtr(bp),a1
  2449.         moveq    #0,d1
  2450.         move.w    4(a1),d1        ; window->LeftEdge
  2451.         bsr    SetToolType
  2452.         moveq    #2,d0            ; WIDTH
  2453.         move.l    Breite(bp),d1
  2454.         bsr    SetToolType
  2455.         moveq    #3,d0            ; HEIGHT
  2456.         move.l    Hoehe(bp),d1
  2457.         bsr    SetToolType
  2458.         moveq    #4,d0            ; SHOWFACE
  2459.         moveq    #0,d1
  2460.         move.b    zeigen(bp),d1
  2461.         bsr    SetToolType
  2462.         moveq    #5,d0            ; HANDTYPE
  2463.         moveq    #0,d1
  2464.         move.b    zeigertyp(bp),d1
  2465.         bsr    SetToolType
  2466.         moveq    #6,d0            ; HANDWIDTH
  2467.         moveq    #0,d1
  2468.         move.b    zeigerbreite(bp),d1
  2469.         bsr    SetToolType
  2470.         moveq    #4,d1            ; BORDERTYPE
  2471.         tst.b    hires(bp)
  2472.         sne    d0
  2473.         and.b    d1,d0
  2474.         tst.b    interlace(bp)
  2475.         sne    d1
  2476.         andi.b    #8,d1
  2477.         add.b    d0,d1
  2478.         add.b    rahmenanz(bp),d1
  2479.         moveq    #7,d0
  2480.         bsr    SetToolType
  2481.         moveq    #4,d1            ; CHIME
  2482.         tst.b    smarthour(bp)
  2483.         sne    d0
  2484.         and.b    d0,d1
  2485.         add.b    chime(bp),d1
  2486.         moveq    #8,d0
  2487.         bsr    SetToolType
  2488.         lea    fmt2(pc),a0        ; new format string
  2489.         move.l    a0,d2
  2490.         tst.b    sekunden(bp)
  2491.         beq.s    9$
  2492.         moveq    #9,d0            ; SECONDS
  2493.         bsr    SetToolType
  2494. 9$        tst.b    oval(bp)
  2495.         beq.s    8$
  2496.         moveq    #10,d0            ; OVAL
  2497.         bsr.s    SetToolType
  2498. 8$        tst.b    schatten(bp)
  2499.         beq.s    7$
  2500.         moveq    #11,d0            ; SHADOW
  2501.         bsr    SetToolType
  2502. 7$        tst.b    closegad(bp)
  2503.         beq.s    6$
  2504.         moveq    #12,d0            ; CLOSEGAD
  2505.         bsr    SetToolType
  2506. 6$        tst.b    useimage(bp)
  2507.         beq.s    5$
  2508.         moveq    #13,d0            ; USEIMAGE
  2509.         bsr    SetToolType
  2510. 5$        lea    fmt3(pc),a0
  2511.         move.l    a0,d2
  2512.         moveq    #14,d0            ; DRAWPENS
  2513.         bsr    SetToolType
  2514.         lea    Pens(bp),a0
  2515.         moveq    #14-1,d0
  2516.         bsr    SetStr
  2517.         moveq    #15,d0            ; PATTERN
  2518.         bsr    SetToolType
  2519.         lea    Must(bp),a0
  2520.         moveq    #4-1,d0
  2521.         bsr    SetStr
  2522.         clr.l    (a2)            ; end list
  2523.         move.l    PrgArg+4(bp),a0
  2524.         move.l    d7,a1
  2525.         move.l    54(a1),d2        ; ttypes1=dobj->ToolTypes;
  2526.         move.l    d6,54(a1)        ; dobj->ToolTypes=ttypes2;
  2527.         RECALL    PutDiskObject
  2528.         move.l    d7,a1
  2529.         move.l    d2,54(a1)        ; dobj->ToolTypes=ttypes1;
  2530. 3$        move.l    d5,a1
  2531.         CALL    FreeVec,SysBase(bp)
  2532. 2$        move.l    d7,a0
  2533.         CALL    FreeDiskObject,IconBase(bp)
  2534. 1$        move.l    d4,d1
  2535.         CALL    CurrentDir,DosBase(bp)
  2536.         movem.l    (sp)+,d2-d7/a2/a3/a6
  2537.         rts
  2538.  
  2539. SetToolType    move.l    a3,(a2)+        ; store ptr
  2540.         bsr.s    GetToolType
  2541.         move.l    a0,d0
  2542.         movem.l    d0/d1/a2/a6,-(sp)    ; stuff args && save regs
  2543.         move.l    d2,a0
  2544.         move.l    sp,a1
  2545.         lea    sc_put(pc),a2
  2546.         CALL    RawDoFmt,SysBase(bp)    ; sprintf()
  2547.         movem.l    (sp)+,d0/d1/a2/a6
  2548. 1$        tst.b    (a3)+            ; get begin of next buffer
  2549.         bne.s    1$
  2550.         rts
  2551.  
  2552. sc_put        move.b    d0,(a3)+        ; stuffchar()
  2553.         rts
  2554.  
  2555. GetToolType    lea    tt_Tab(pc),a0        ; get ptr to tooltype
  2556.         add.w    d0,d0
  2557.         adda.w    0(a0,d0.w),a0
  2558.         rts
  2559.  
  2560. SetStr        move.l    -4(a2),a3        ; make a string
  2561. 2$        tst.b    (a3)+
  2562.         bne.s    2$
  2563.         subq.w    #1,a3
  2564. 1$        move.b    (a0),d1
  2565.         lsr.b    #4,d1
  2566.         bsr.s    dtox            ; convert to ascii
  2567.         move.b    d1,(a3)+
  2568.         moveq    #$f,d1
  2569.         and.b    (a0)+,d1
  2570.         bsr.s    dtox            ; convert to ascii
  2571.         move.b    d1,(a3)+
  2572.         dbra    d0,1$
  2573.         clr.b    (a3)+            ; end string
  2574.         rts
  2575.  
  2576. dtox        addi.b    #'0',d1            ; make ascii
  2577.         cmpi.b    #'9'+1,d1
  2578.         bcs.s    1$
  2579.         addq.b    #7,d1
  2580. 1$        rts
  2581.  
  2582. ***************************************************************************
  2583.  
  2584. TestAlarm    move.l    d3,-(sp)        ; check for beep
  2585.         move.l    d2,-(sp)
  2586.         moveq    #0,d3
  2587.         move.w    std(bp),d3
  2588.         move.w    min(bp),d2
  2589. ; st2 = std/5;
  2590.         divu    #5,d3
  2591. ; if (!st2)
  2592.         tst.w    d3
  2593.         bne.s    7$
  2594. ;    st2=12;
  2595.         moveq    #12,d3
  2596. ; if (alarm && almin==min && alstd==st2)
  2597. 7$        tst.b    alarm(bp)
  2598.         beq.s    6$
  2599.         lea    alarmtune(pc),a0
  2600.         cmp.w    almin(bp),d2
  2601.         bne.s    6$
  2602.         cmp.w    alstd(bp),d3
  2603.         beq.s    2$
  2604. ; if (chime && !min)
  2605. 6$        move.b    chime(bp),d1
  2606.         beq.s    1$
  2607.         tst.w    d2
  2608.         bne.s    5$
  2609. ; calc -> &hourtune[smarthour?24-st2*2:22]
  2610.         lea    hourtune(pc),a0
  2611.         moveq    #22*2,d0
  2612.         tst.b    smarthour(bp)
  2613.         beq.s    3$
  2614.         moveq    #24*2,d0
  2615.         add.w    d3,d3
  2616.         add.w    d3,d3
  2617.         sub.w    d3,d0
  2618.         bra.s    3$
  2619. ; if (chime==2 && (min==15 || min==30 || min==45))
  2620. 5$        subq.b    #2,d1
  2621.         bne.s    1$
  2622.         lea    quartertune(pc),a0
  2623.         moveq    #6*2,d0            ; max value
  2624. 4$        subq.w    #2*2,d0
  2625.         addi.w    #-15,d2
  2626.         bcc.s    1$            ; different from 15,30,45
  2627.         bne.s    4$
  2628. ; startune(tune);
  2629. 3$        lea    0(a0,d0.w),a0
  2630. 2$        move.l    a0,PlayTune(bp)        ; store tune address
  2631.         bsr.s    StartTune
  2632. 1$        move.l    (sp)+,d2
  2633.         move.l    (sp)+,d3
  2634.         rts
  2635.  
  2636. ;--------------------------------------------------------------------------
  2637.  
  2638. StartTune    move.l    a6,-(sp)
  2639.         move.l    a2,-(sp)
  2640.         tst.b    SoundOn(bp)
  2641.         bne.s    1$
  2642.         move.l    AudioIO+0(bp),a2
  2643.         move.b    #90,9(a2)        ; ln_Pri = 90;
  2644.         move.w    #32,28(a2)        ; io_Command = ADCMD_ALLOCATE;
  2645.         move.b    #1<<6,30(a2)        ; io_Flags = ADIOF_NOWAIT;
  2646.         lea    cmap(pc),a0
  2647.         move.l    a0,34(a2)        ; ioa_Data = ChannelMap;
  2648.         moveq    #4,d0
  2649.         move.l    d0,38(a2)        ; ioa_Length = 4;
  2650.         move.l    a2,a1
  2651.         CALL    BeginIO,20(a1)
  2652.         move.l    a2,a1
  2653.         CALL    WaitIO,SysBase(bp)
  2654.         tst.b    d0
  2655.         bne.s    1$            ; error !
  2656.         st    SoundOn(bp)
  2657.         moveq    #2,d0
  2658.         and.b    $bfe001,d0
  2659.         bne.s    2$            ; filter is off !
  2660.         ori.b    #2,$bfe001
  2661.         st    filter(bp)
  2662. 2$        move.l    a2,a0
  2663.         move.l    AudioIO+4(bp),a1
  2664.         moveq    #68,d0
  2665.         RECALL    CopyMemQuick        ; fill second request
  2666.         bsr.s    PlayNote
  2667.         bsr.s    PlayNote
  2668. 1$        move.l    (sp)+,a2
  2669.         move.l    (sp)+,a6
  2670.         rts
  2671.  
  2672. ;--------------------------------------------------------------------------
  2673.  
  2674. PlayNote    move.l    a6,-(sp)
  2675.         moveq    #0,d0
  2676.         moveq    #0,d1
  2677.         move.b    reqnr(bp),d1        ; old reqnr
  2678.         seq    d0
  2679.         neg.b    d0
  2680.         move.b    d0,reqnr(bp)        ; new reqnr
  2681.         lea    AudioSent(bp),a1
  2682.         clr.b    0(a1,d1.w)        ; audsent[reqnr]=0;
  2683.         move.l    PlayTune(bp),a0
  2684.         tst.w    0(a0)
  2685.         bne.s    2$            ; tune not ready
  2686.         tst.b    0(a1,d0.w)
  2687.         bne.s    3$            ; not last
  2688.         move.l    SysBase(bp),a6
  2689.         bsr.s    EndTune            ; free channels
  2690. 3$        bra.s    1$
  2691. 2$        st    0(a1,d1.w)        ; audsent[reqnr]=1;
  2692.         add.w    d1,d1
  2693.         add.w    d1,d1
  2694.         lea    AudioIO+0(bp),a1
  2695.         move.l    0(a1,d1.w),a1
  2696.         move.w    #3,28(a1)        ; io_Command = CMD_WRITE;
  2697.         move.b    #1<<4,30(a1)        ; io_Flags = ADIOF_PERVOL;
  2698.         add.l    WaveForm(bp),d1
  2699.         move.l    d1,34(a1)        ; ioa_Data = &waveform[reqnr*4];
  2700.         moveq    #4,d0
  2701.         move.l    d0,38(a1)        ; ioa_Length = 4;
  2702.         move.w    #500,42(a1)        ; ioa_Period = 500;
  2703.         move.w    #64,44(a1)        ; ioa_Volume = 64;
  2704.         move.w    0(a0),46(a1)        ; ioa_Cycles = *playtune++;
  2705.         addq.l    #2,PlayTune(bp)
  2706.         CALL    BeginIO,20(a1)
  2707. 1$        move.l    (sp)+,a6
  2708.         rts
  2709.  
  2710. ;--------------------------------------------------------------------------
  2711.  
  2712. EndTune        clr.b    SoundOn(bp)
  2713.         tst.b    filter(bp)        ; trigger filter ?
  2714.         beq.s    1$
  2715.         and.b    #$fd,$bfe001        ; filter on
  2716.         clr.b    filter(bp)
  2717. 1$        move.l    AudioIO+0(bp),a1
  2718.         move.w    #9,28(a1)        ; ioa_Command = ADCMD_FREE
  2719.         jmp    _LVODoIO(a6)
  2720.  
  2721. ***************************************************************************
  2722.  
  2723. ; a0 - window table
  2724. ; a1 - gadget tags
  2725.  
  2726. CreateRequest    movem.l    d2-d5/a2/a3/a6,-(sp)
  2727.         move.l    a0,a3
  2728.         move.l    a1,d2
  2729.         lea    NewWinBuf+18(bp),a0    ; *glistpointer (temp)
  2730.         clr.l    0(a0)
  2731.         CALL    CreateContext,GadsBase(bp)
  2732.         move.l    d0,d5
  2733.         beq    1$
  2734.         lea    NewWinBuf(bp),a2
  2735.         move.l    #100<<16+100,0(a2)    ; left && top
  2736.         clr.l    4(a2)            ; width && height
  2737.         moveq    #0,d3
  2738.         move.w    (a3)+,d3        ; idcmp as a word
  2739.         move.l    #$1100e,14(a2)        ; flags
  2740.         moveq    #0,d0
  2741.         move.b    (a3)+,d0        ; string number
  2742.         bsr    GetLocStr
  2743.         move.l    d0,26(a2)        ; window title
  2744.         clr.w    NewGad+16(bp)        ; clear gadget id
  2745.         move.b    (a3)+,d4        ; gadget counter
  2746. 4$        lea    NewGad(bp),a2        ; structure to fill
  2747.         move.l    WinPtr(bp),a0
  2748.         move.l    46(a0),a0        ; screen
  2749.         moveq    #0,d0            ; LeftEdge
  2750.         move.b    (a3)+,d0
  2751.         add.b    36(a0),d0        ; screen->WBorLeft;
  2752.         move.w    d0,0(a2)
  2753.         moveq    #1,d0            ; TopEdge
  2754.         add.b    (a3)+,d0
  2755.         add.b    35(a0),d0        ; screen->WBorTop
  2756.         add.w    142(a0),d0        ; screen->RastPort.TxHeight
  2757.         move.w    d0,2(a2)
  2758.         move.b    (a3)+,5(a2)        ; Width
  2759.         move.b    (a3)+,7(a2)        ; Height
  2760.         moveq    #0,d0
  2761.         move.b    (a3)+,d0
  2762.         beq.s    3$            ; no text
  2763.         bsr    GetLocStr
  2764. 3$        lea    TextAttr(bp),a0
  2765.         movem.l    d0/a0,8(a2)        ; text && font to use
  2766.         addq.w    #1,16(a2)        ; increment GadgetID
  2767.         move.l    VisualInfo(bp),22(a2)
  2768.         moveq    #0,d0
  2769.         move.b    (a3)+,d0
  2770.         move.l    d5,a0
  2771.         lea    NewGad(bp),a1
  2772.         move.l    d2,a2
  2773.         move.l    0(a2),a2
  2774.         RECALL    CreateGadgetA
  2775.         move.l    d0,d5
  2776.         beq.s    2$            ; error !
  2777.         addq.l    #4,d2
  2778.         subq.b    #1,d4
  2779.         bne.s    4$            ; not ready
  2780.         lea    NewWinBuf(bp),a0
  2781.         lea    windowtags(pc),a1
  2782.         bsr.s    OpenWindow
  2783.         beq.s    2$            ; failed !
  2784.         move.l    d2,a0
  2785.         move.w    #-1,a1
  2786.         lea    ProgName(pc),a2
  2787.         RECALL    SetWindowTitles        ; according screentitle
  2788.         move.l    d2,a0
  2789.         suba.l    a1,a1
  2790.         CALL    GT_RefreshWindow,GadsBase(bp)
  2791.         move.l    d2,d0
  2792.         move.l    NewWinBuf+18(bp),d1    ; return glist
  2793.         bra.s    1$
  2794. 2$        move.l    NewWinBuf+18(bp),a0    ; glistpointer
  2795.         CALL    FreeGadgets,GadsBase(bp)
  2796.         moveq    #0,d0
  2797. 1$        movem.l    (sp)+,d2-d5/a2/a3/a6
  2798.         rts
  2799.  
  2800. ;--------------------------------------------------------------------------
  2801.  
  2802. OpenWindow    CALL    OpenWindowTagList,IntBase(bp)
  2803.         move.l    d0,d2
  2804.         beq.s    1$
  2805.         move.l    d2,a0
  2806.         move.l    WinPort(bp),86(a0)
  2807.         move.l    d3,d0
  2808.         RECALL    ModifyIDCMP
  2809.         tst.w    d0
  2810.         bne.s    1$
  2811.         bsr    CloseWinSafely
  2812.         moveq    #0,d0
  2813. 1$        rts
  2814.  
  2815. ***************************************************************************
  2816.  
  2817. GetLocStr    move.l    a6,-(sp)        ; get localized string
  2818.         lea    LocaleTab(pc),a1
  2819.         add.w    d0,d0
  2820.         add.w    0(a1,d0.w),a1        ; default !
  2821.         lsr.w    #1,d0
  2822.         move.l    Catalog(bp),d1
  2823.         beq.s    1$            ; no catalog !
  2824.         move.l    d1,a0
  2825.         CALL    GetCatalogStr,LocBase(bp)
  2826.         move.l    d0,a1
  2827. 1$        move.l    a1,d0
  2828.         move.l    (sp)+,a6
  2829.         rts
  2830.  
  2831. ***************************************************************************
  2832.  
  2833. CopyTiledBitMap    movem.l    d2-d7/a2/a3/a5/a6,-(sp)    ; duplicate background image
  2834.         move.l    GfxBase(bp),a6
  2835.         move.l    ImgBitMapHeader(bp),a0
  2836.         moveq    #0,d0
  2837.         move.w    (a0)+,d0
  2838.         move.l    d0,a5            ; SrcSizeX
  2839.         move.w    (a0),d0
  2840.         move.l    d0,a3            ; SrxSizeY
  2841.         suba.l    a2,a2
  2842.         moveq    #-1,d7
  2843.         moveq    #256-$c0,d6
  2844.         neg.b    d6
  2845.         move.l    ImgBitMap(bp),a0
  2846.         moveq    #0,d0
  2847.         moveq    #0,d1
  2848.         lea    BitMap1(bp),a1
  2849.         moveq    #0,d2
  2850.         moveq    #0,d3
  2851.         move.l    Breit2(bp),d4        ; MIN(SrcSizeX,DstSizeX)
  2852.         cmp.l    d4,a5
  2853.         bcc.s    11$
  2854.         move.l    a5,d4
  2855. 11$        move.l    Hoehe2(bp),d5        ; MIN(SrcSizeY,DstSizeY)
  2856.         cmp.l    d5,a3
  2857.         bcc.s    10$
  2858.         move.l    a3,d5
  2859. 10$        RECALL    BltBitMap
  2860.         move.l    a5,d2            ; Pos = SrcSizeX;
  2861.         move.l    Breit2(bp),d4        ; Size =
  2862.         sub.l    d2,d4
  2863.         cmp.l    d4,a5
  2864.         bcc.s    9$
  2865.         move.l    a5,d4            ; MIN(SrcSizeX,DstSizeX-Pos);
  2866. 9$        cmp.l    Breit2(bp),d2
  2867.         bcc.s    5$            ; Pos<DstSizeX ?
  2868. 8$        lea    BitMap1(bp),a0
  2869.         moveq    #0,d0
  2870.         moveq    #0,d1
  2871.         move.l    a0,a1
  2872.         moveq    #0,d3
  2873.         move.l    Hoehe2(bp),d5        ; MIN(SrcSizeY,DstSizeY)
  2874.         cmp.l    d5,a3
  2875.         bcc.s    7$
  2876.         move.l    a3,d5
  2877. 7$        RECALL    BltBitMap
  2878.         add.l    d4,d2            ; Pos += Size;
  2879.         add.l    d4,d4            ; Size =
  2880.         move.l    Breit2(bp),d0
  2881.         sub.l    d2,d0
  2882.         cmp.l    d4,d0
  2883.         bcc.s    6$
  2884.         move.l    d0,d4            ; MIN(Size<<1,DstSizeY-Pos);
  2885. 6$        cmp.l    Breit2(bp),d2
  2886.         bcs.s    8$            ; DstSizeX>Pos ?
  2887. 5$        move.l    a3,d3            ; Pos = SrcSizeY;
  2888.         move.l    Hoehe2(bp),d5        ; Size =
  2889.         sub.l    d3,d5
  2890.         cmp.l    d5,a3
  2891.         bcc.s    4$
  2892.         move.l    a3,d5            ; MIN(SrcSizeY,DstSizeY-Pos);
  2893. 4$        cmp.l    Hoehe2(bp),d3
  2894.         bcc.s    1$            ; Pos<DstSizeY ?
  2895. 3$        lea    BitMap1(bp),a0
  2896.         moveq    #0,d0
  2897.         moveq    #0,d1
  2898.         move.l    a0,a1
  2899.         moveq    #0,d2
  2900.         move.l    Breit2(bp),d4
  2901.         RECALL    BltBitMap
  2902.         add.l    d5,d3            ; Pos += Size;
  2903.         add.l    d5,d5            ; Size =
  2904.         move.l    Hoehe2(bp),d0
  2905.         sub.l    d3,d0
  2906.         cmp.l    d5,d0
  2907.         bcc.s    2$
  2908.         move.l    d0,d5            ; MIN(Size<<1,DstSizeY-Pos);
  2909. 2$        cmp.l    Hoehe2(bp),d3
  2910.         bcs.s    3$            ; DstSizeY>Pos ?
  2911. 1$        movem.l    (sp)+,d2-d7/a2/a3/a5/a6
  2912.         rts
  2913.  
  2914. ***************************************************************************
  2915.  
  2916. ; 32-bit division (only positive values!)
  2917.  
  2918. LDiv        move.l    d3,-(sp)
  2919.         move.l    d2,-(sp)
  2920.         move.w    d1,d3
  2921.         move.w    d0,d2
  2922.         clr.w    d0
  2923.         swap    d0
  2924.         divu.w    d3,d0
  2925.         move.l    d0,d1
  2926.         swap    d0
  2927.         move.w    d2,d1
  2928.         divu.w    d3,d1
  2929.         move.w    d1,d0
  2930.         clr.w    d1
  2931.         swap    d1
  2932.         move.l    (sp)+,d2
  2933.         move.l    (sp)+,d3
  2934.         rts
  2935.  
  2936. ***************************************************************************
  2937.  
  2938. ; static data
  2939.  
  2940. GadgetList    dc.b    $03,$80            ; GTYP_CLOSE
  2941.         dc.b    $13,$40            ; GTYP_DEPTH
  2942.         dc.b    $1b,$10            ; GTYP_SIZING
  2943.         dc.b    $63,$20            ; GTYP_WDRAGGING
  2944.  
  2945. sizes        dc.b    0,0,3,2,-3,0,3,2,-3,-2,3,2,0,2,0,-4
  2946.  
  2947. colwintab    WINIT    $240,Choose,1        ; window && gadget defintion
  2948.         GITEM    4,2,144,68,0,8
  2949.  
  2950. almwintab    WINIT    $270,Alarm,4        ; window && gadget definition
  2951.         GITEM    42,15,20,39,0,11
  2952.         GITEM    82,15,20,39,0,11
  2953.         GITEM    2,58,70,12,Use,1
  2954.         GITEM    76,58,70,12,Cancel,1
  2955.  
  2956.         cnop    0,4
  2957.  
  2958. almgadtags1    dc.l    $80080026,1        ; GSTL_Min,1
  2959.         dc.l    $80080027,12        ; GSTL_Max,12
  2960.         dc.l    $80080029,10        ; GSTL_MaxLevelLen,10
  2961.         dc.l    $8008002B,4        ; GSTL_PlaceText,PLACETEXT_ABOVE
  2962.         dc.l    $80031001,2        ; PGA_FREEDOM,LORIENT_VERT
  2963.         dc.l    $80030016,1        ; GA_Relverify,TRUE
  2964.         dc.l    0
  2965.  
  2966. almgadtags2    dc.l    $80080026,0        ; GSTL_Min,0
  2967.         dc.l    $80080027,59        ; GSTL_Max,59
  2968.         dc.l    $80080029,5        ; GSTL_MaxLevelLen,5
  2969.         dc.l    $8008002B,4        ; GSTL_PlaceText,PLACETEXT_ABOVE
  2970.         dc.l    $80031001,2        ; PGA_FREEDOM,LORIENT_VERT
  2971.         dc.l    $80030016,1        ; GA_Relverify,TRUE
  2972.         dc.l    0
  2973.  
  2974. windowtags    dc.l    $80000076,148        ; WA_InnerWidth,width
  2975.         dc.l    $80000077,72        ; WA_InnerHeight,height
  2976. maintags    dc.l    $80000090,1        ; WA_AutoAdjust,TRUE
  2977.         dc.l    0
  2978.  
  2979. MenuTag        dc.l    $80080043,1        ; GTMN_NewLookMenus,TRUE
  2980.         dc.l    0
  2981.  
  2982. dttags        dc.l    $8000101F,$70696374    ; DTA_GroupID,'pict'
  2983.         dc.l    $800010D5,1        ; PDTA_FreeSourceBitmap,TRUE
  2984.         dc.l    $84000000,0        ; OBP_Precision,PRECISION_IMAGE
  2985.         dc.l    0
  2986.  
  2987. MenuList    MITEM    1,Project,0,0,0        ; menu structure (compact)
  2988.          MITEM     2,About,0,0
  2989.          MITEM     2,Quit,0,0
  2990.         MITEM    1,Settings,0,0
  2991.          MITEM     2,Seconds,9,0
  2992.          MITEM     2,Oval,9,0
  2993.          MITEM     2,Show,0,0
  2994.           MITEM      3,Minutes,1,2|4|8|16
  2995.           MITEM      3,Hours,1,1|4|8|16
  2996.           MITEM      3,Quarter,1,1|2|8|16
  2997.           MITEM      3,One,1,1|2|4|16
  2998.           MITEM      3,None,1,1|2|4|8
  2999.          MITEM     2,Hands,0,0
  3000.           MITEM      3,Line,1,2|4|8
  3001.           MITEM      3,Triangle,1,1|4|8
  3002.           MITEM      3,Rhombus,1,1|2|8
  3003.           MITEM      3,Rectangle,1,1|2|4
  3004.           MITEM      3,-1,0,0
  3005.           MITEM      3,VeryThin,1,128+(2|4|8|16)
  3006.           MITEM      3,Thin,1,128+(1|4|8|16)
  3007.           MITEM      3,Normal,1,128+(1|2|8|16)
  3008.           MITEM      3,Thick,1,128+(1|2|4|16)
  3009.           MITEM      3,VeryThick,1,128+(1|2|4|8)
  3010.          MITEM     2,Shadow,9,0
  3011.          MITEM     2,Border,0,0
  3012.           MITEM      3,None,1,2|4
  3013.           MITEM      3,Single,1,1|4
  3014.           MITEM      3,Double,1,1|2
  3015.           MITEM      3,-1,0,0
  3016.           MITEM      3,Hires,9,0
  3017.           MITEM      3,Interlace,9,0
  3018.          MITEM     2,Chime,0,0
  3019.           MITEM      3,None,1,2|4
  3020.           MITEM      3,Hours,1,1|4
  3021.           MITEM      3,Quarter,1,1|2
  3022.           MITEM      3,-1,0,0
  3023.           MITEM      3,Smart,9,0
  3024.          MITEM     2,Alarm,0,0
  3025.           MITEM      3,Set,0,0
  3026.           MITEM      3,On,9,0
  3027.          MITEM     2,UseImage,9,0
  3028.          MITEM     2,CloseGad,9,0
  3029.           MITEM     2,-1,0,0
  3030.          MITEM     2,SaveSettings,0,0
  3031.         MITEM    1,Colors,0,0
  3032.          MITEM     2,Seconds,0,0
  3033.          MITEM     2,MinAPen,0,0
  3034.          MITEM     2,MinOPen,0,0
  3035.          MITEM     2,HourAPen,0,0
  3036.          MITEM     2,HourOPen,0,0
  3037.          MITEM     2,Shadow,0,0
  3038.          MITEM     2,Str12,0,0
  3039.          MITEM     2,Quarter,0,0
  3040.          MITEM     2,Hours,0,0
  3041.          MITEM     2,Minutes,0,0
  3042.          MITEM     2,Border0,0,0
  3043.          MITEM     2,Border1,0,0
  3044.          MITEM     2,Border2,0,0
  3045.          MITEM     2,Border3,0,0
  3046.         MITEM    1,Pattern,0,0
  3047.          MITEM     2,Color0,0,0
  3048.          MITEM     2,Color1,0,0
  3049.          MITEM     2,Color2,0,0
  3050.          MITEM     2,Color3,0,0
  3051.  
  3052. LocaleTab    ADDLOC    Project,0        ; all strings
  3053.         ADDLOC    About
  3054.         ADDLOC    AboutKey
  3055.         ADDLOC    Quit
  3056.         ADDLOC    QuitKey
  3057.         ADDLOC    Settings
  3058.         ADDLOC    Seconds
  3059.         ADDLOC    Oval
  3060.         ADDLOC    Show
  3061.         ADDLOC    Minutes
  3062.         ADDLOC    Hours
  3063.         ADDLOC    Quarter
  3064.         ADDLOC    One
  3065.         ADDLOC    None
  3066.         ADDLOC    Hands
  3067.         ADDLOC    Line
  3068.         ADDLOC    Triangle
  3069.         ADDLOC    Rhombus
  3070.         ADDLOC    Rectangle
  3071.         ADDLOC    VeryThin
  3072.         ADDLOC    Thin
  3073.         ADDLOC    Normal
  3074.         ADDLOC    Thick
  3075.         ADDLOC    VeryThick
  3076.         ADDLOC    Shadow
  3077.         ADDLOC    Border
  3078.         ADDLOC    Single
  3079.         ADDLOC    Double
  3080.         ADDLOC    Hires
  3081.         ADDLOC    Interlace
  3082.         ADDLOC    Chime
  3083.         ADDLOC    Smart
  3084.         ADDLOC    Alarm
  3085.         ADDLOC    Set
  3086.         ADDLOC    On
  3087.         ADDLOC    UseImage
  3088.         ADDLOC    CloseGad
  3089.         ADDLOC    SaveSettings
  3090.         ADDLOC    SaveKey
  3091.         ADDLOC    Colors
  3092.         ADDLOC    MinAPen
  3093.         ADDLOC    MinOPen
  3094.         ADDLOC    HourAPen
  3095.         ADDLOC    HourOPen
  3096.         ADDLOC    Str12
  3097.         ADDLOC    Border0
  3098.         ADDLOC    Border1
  3099.         ADDLOC    Border2
  3100.         ADDLOC    Border3
  3101.         ADDLOC    Pattern
  3102.         ADDLOC    Color0
  3103.         ADDLOC    Color1
  3104.         ADDLOC    Color2
  3105.         ADDLOC    Color3
  3106.         ADDLOC    Description
  3107.         ADDLOC    Choose
  3108.         ADDLOC    Use
  3109.         ADDLOC    Cancel
  3110.  
  3111. LOCALE_START                    ; locale area begin
  3112.  
  3113. ; CATALOG TolleUhr
  3114. ; VERSION 1.3
  3115. ; CATDATE 5.5.95
  3116.  
  3117. m_Project    dc.b    'Project',0
  3118. ; D            'Projekt',0
  3119. m_About        dc.b    'About',0
  3120. ; D            'Über',0
  3121. m_AboutKey    dc.b    '?',0
  3122. ; D            '?',0
  3123. m_Quit        dc.b    'Quit',0
  3124. ; D            'Ende',0
  3125. m_QuitKey    dc.b    'Q',0
  3126. ; D            'E',0
  3127. m_Settings    dc.b    'Settings',0
  3128. ; D            'Einstellungen',0
  3129. m_Seconds    dc.b    'Seconds',0
  3130. ; D            'Sekunden',0
  3131. m_Oval        dc.b    'Oval',0
  3132. ; D            'Oval',0
  3133. m_Show        dc.b    'Show',0
  3134. ; D            'Zeigen',0
  3135. m_Minutes    dc.b    'Minutes',0
  3136. ; D            'Minuten',0
  3137. m_Hours        dc.b    'Hours',0
  3138. ; D            'Stunden',0
  3139. m_Quarter    dc.b    'Quarter',0
  3140. ; D            'Viertel',0
  3141. m_One        dc.b    'One',0
  3142. ; D            'Eins',0
  3143. m_None        dc.b    'None',0
  3144. ; D            'Nichts',0
  3145. m_Hands        dc.b    'Hands',0
  3146. ; D            'Zeiger',0
  3147. m_Line        dc.b    'Line',0
  3148. ; D            'Linie',0
  3149. m_Triangle    dc.b    'Triangle',0
  3150. ; D            'Dreieck',0
  3151. m_Rhombus    dc.b    'Rhombus',0
  3152. ; D            'Raute',0
  3153. m_Rectangle    dc.b    'Rectangle',0
  3154. ; D            'Rechteck',0
  3155. m_VeryThin    dc.b    'Very Thin',0
  3156. ; D            'Sehr Dünn',0
  3157. m_Thin        dc.b    'Thin',0
  3158. ; D            'Dünn',0
  3159. m_Normal    dc.b    'Normal',0
  3160. ; D            'Normal',0
  3161. m_Thick        dc.b    'Thick',0
  3162. ; D            'Dick',0
  3163. m_VeryThick    dc.b    'Very Thick',0
  3164. ; D            'Sehr Dick',0
  3165. m_Shadow    dc.b    'Shadow',0
  3166. ; D            'Schatten',0
  3167. m_Border    dc.b    'Border',0
  3168. ; D            'Rand',0
  3169. m_Single    dc.b    'Single',0
  3170. ; D            'Einfach',0
  3171. m_Double    dc.b    'Double',0
  3172. ; D            'Doppelt',0
  3173. m_Hires        dc.b    'HiRes',0
  3174. ; D            'HiRes',0
  3175. m_Interlace    dc.b    'Interlace',0
  3176. ; D            'Interlace',0
  3177. m_Chime        dc.b    'Chime',0
  3178. ; D            'Glocke',0
  3179. m_Smart        dc.b    'Smart',0
  3180. ; D            'Elegant',0
  3181. m_Alarm        dc.b    'Alarm',0
  3182. ; D            'Alarm',0
  3183. m_Set        dc.b    'Set',0
  3184. ; D            'Stellen',0
  3185. m_On        dc.b    'On',0
  3186. ; D            'An',0
  3187. m_UseImage    dc.b    'Use Image',0
  3188. ; D            'Image benutzen',0
  3189. m_CloseGad    dc.b    'Close Gadget',0
  3190. ; D            'Schließ-Gadget',0
  3191. m_SaveSettings    dc.b    'Save Settings',0
  3192. ; D            'Speichern',0
  3193. m_SaveKey    dc.b    'S',0
  3194. ; D            'S',0
  3195. m_Colors    dc.b    'Colors',0
  3196. ; D            'Farben',0
  3197. m_MinAPen    dc.b    'Min. APen',0
  3198. ; D            'Min. APen',0
  3199. m_MinOPen    dc.b    'Min. Open',0
  3200. ; D            'Min. OPen',0
  3201. m_HourAPen    dc.b    'Hour Apen',0
  3202. ; D            'Std. APen',0
  3203. m_HourOPen    dc.b    'Hour Open',0
  3204. ; D            'Std. OPen',0
  3205. m_Str12        dc.b    '12',0
  3206. ; D            '12',0
  3207. m_Border0    dc.b    'Border 0',0
  3208. ; D            'Rand 0',0
  3209. m_Border1    dc.b    'Border 1',0
  3210. ; D            'Rand 1',0
  3211. m_Border2    dc.b    'Border 2',0
  3212. ; D            'Rand 2',0
  3213. m_Border3    dc.b    'Border 3',0
  3214. ; D            'Rand 3',0
  3215. m_Pattern    dc.b    'Pattern',0
  3216. ; D            'Muster',0
  3217. m_Color0    dc.b    'Color 0',0
  3218. ; D            'Farbe 0',0
  3219. m_Color1    dc.b    'Color 1',0
  3220. ; D            'Farbe 1',0
  3221. m_Color2    dc.b    'Color 2',0
  3222. ; D            'Farbe 2',0
  3223. m_Color3    dc.b    'Color 3',0
  3224. ; D            'Farbe 3',0
  3225. m_Description    dc.b    'a really nice clock !',0
  3226. ; D            'Eine wirklich tolle Uhr !',0
  3227. m_Choose    dc.b    'Choose one:',0
  3228. ; D            'Wähle eine:',0
  3229. m_Use        dc.b    'Use',0
  3230. ; D            'Benutzen',0
  3231. m_Cancel    dc.b    'Cancel',0
  3232. ; D            'Abbruch',0
  3233.  
  3234. LOCALE_END                    ; locale area end
  3235.  
  3236. DosName        dc.b    'dos.library',0
  3237. IconName    dc.b    'icon.library',0
  3238. IntName        dc.b    'intuition.library',0
  3239. GfxName        dc.b    'graphics.library',0
  3240. GadsName    dc.b    'gadtools.library',0
  3241. DtName        dc.b    'datatypes.library',0
  3242. LocName        dc.b    'locale.library',0
  3243. LocCat        dc.b    'tolleuhr.catalog',0
  3244. TimerName    dc.b    'timer.device',0
  3245. AudioName    dc.b    'audio.device',0
  3246. TopazName    dc.b    'topaz.font',0
  3247.  
  3248. template    dc.b    '/M,TOP/N,LEFT/N,WIDTH/N,HEIGHT/N,SECONDS/S,PATTERN/K,'
  3249.         dc.b    'OVAL/S,SHADOW/S,SHOWFACE/N,HANDTYPE/N,HANDWIDTH/N,'
  3250.         dc.b    'DRAWPENS/K,BORDERTYPE/N,CHIME/N,CLOSEGAD/S,USEIMAGE/S,'
  3251.         dc.b    'NOREMAP/S,IMAGE/K,PUBSCREEN/K,TASKPRI/N',0
  3252.  
  3253. linefeed    dc.b    10,0
  3254.  
  3255.         dc.b    '$VER: '
  3256. ProgName    dc.b    'TolleUhr 1.3 (18.5.95) by M.Fleischer and G.Nikl in 1993/95',0
  3257.  
  3258. fmt1        dc.b    '%s=%ld',0        ; format templates for tooltypes
  3259. fmt2        dc.b    '%s',0
  3260. fmt3        dc.b    '%s=0x',0
  3261. fmt4        dc.b    '%2ld',0
  3262. fmt5        dc.b    '%02ld',0
  3263.  
  3264.         cnop    0,2
  3265.  
  3266. ; !!!! do NOT change table order !!!!!
  3267.  
  3268. tt_Tab        ADDCMD    tt_,top,0
  3269.         ADDCMD    tt_,left
  3270.         ADDCMD    tt_,width
  3271.         ADDCMD    tt_,height
  3272.         ADDCMD    tt_,showface
  3273.         ADDCMD    tt_,handtype
  3274.         ADDCMD    tt_,handwidth
  3275.         ADDCMD    tt_,bordertype
  3276.         ADDCMD    tt_,chime
  3277.         ADDCMD    tt_,seconds
  3278.         ADDCMD    tt_,oval
  3279.         ADDCMD    tt_,shadow
  3280.         ADDCMD    tt_,closegad
  3281.         ADDCMD    tt_,useimage
  3282.         ADDCMD    tt_,drawpens
  3283.         ADDCMD    tt_,pattern
  3284.  
  3285. tt_top        dc.b    'TOP',0
  3286. tt_left        dc.b    'LEFT',0
  3287. tt_width    dc.b    'WIDTH',0
  3288. tt_height    dc.b    'HEIGHT',0
  3289. tt_showface    dc.b    'SHOWFACE',0
  3290. tt_handtype    dc.b    'HANDTYPE',0
  3291. tt_handwidth    dc.b    'HANDWIDTH',0
  3292. tt_bordertype    dc.b    'BORDERTYPE',0
  3293. tt_chime    dc.b    'CHIME',0
  3294. tt_seconds    dc.b    'SECONDS',0
  3295. tt_oval        dc.b    'OVAL',0
  3296. tt_shadow    dc.b    'SHADOW',0
  3297. tt_closegad    dc.b    'CLOSEGAD',0
  3298. tt_useimage    dc.b    'USEIMAGE',0
  3299. tt_drawpens    dc.b    'DRAWPENS',0
  3300. tt_pattern    dc.b    'PATTERN',0
  3301.  
  3302.         cnop    0,2
  3303.  
  3304. handwidth    dc.w    4000,3250,2500,1750,1000
  3305.  
  3306. ; sound data
  3307.  
  3308. alarmtune    dc.w    800,800,800,800,800,800,800,1600
  3309.         dc.w    800,800,800,800,800,800,800,1600
  3310.         dc.w    800,800,800,800,800,800,800,1600
  3311.         dc.w    800,800,800,800,800,800,800,1600
  3312.         dc.w    800,800,800,800,800,800,800,4,0
  3313.  
  3314. hourtune    dc.w    800,1600,800,1600,800,1600,800,1600
  3315.         dc.w    800,1600,800,1600,800,1600,800,1600
  3316.         dc.w    800,1600,800,1600,800,1600,800,4,0
  3317.  
  3318. quartertune    dc.w    400,400,400,400,400,4,0
  3319.  
  3320. ; sound channel allocation map
  3321.  
  3322. cmap        dc.b    1,2,4,8
  3323.  
  3324. ; Farbnummern (defaults)
  3325.  
  3326. pens        dc.b    2,0,2,0,2,1,2,2,2,2,0,1,2,3
  3327.  
  3328. ; Indizes fuer Zifferblatt
  3329.  
  3330. pent        dc.b    6,8,8,7,8,8,7,8,8,7,8,8
  3331.  
  3332. ; für ovales Zifferblatt
  3333.  
  3334. sinus        dc.b    $00,$0D,$1A,$27,$34,$40,$4B,$55,$5E,$67
  3335.         dc.b    $6E,$74,$79,$7C,$7E,$7F,$7E,$7C,$79,$74
  3336.         dc.b    $6E,$67,$5E,$55,$4B,$40,$34,$27,$1A,$0D
  3337.         dc.b    $00,$F3,$E6,$D9,$CC,$C0,$B5,$AB,$A2,$99
  3338.         dc.b    $92,$8C,$87,$84,$82,$81,$82,$84,$87,$8C
  3339.         dc.b    $92,$99,$A2,$AB,$B5,$C0,$CC,$D9,$E6,$F3
  3340.  
  3341. cosinus        dc.b    $7F,$7E,$7C,$79,$74,$6E,$67,$5E,$55,$4B
  3342.         dc.b    $40,$34,$27,$1A,$0D,$00,$F3,$E6,$D9,$CC
  3343.         dc.b    $C0,$B5,$AB,$A2,$99,$92,$8C,$87,$84,$82
  3344.         dc.b    $81,$82,$84,$87,$8C,$92,$99,$A2,$AB,$B5
  3345.         dc.b    $C0,$CC,$D9,$E6,$F3,$00,$0D,$1A,$27,$34
  3346.         dc.b    $40,$4B,$55,$5E,$67,$6E,$74,$79,$7C,$7E
  3347.  
  3348. ; für rechteckiges Zifferblatt
  3349.  
  3350. srect        dc.b    $00,$0D,$1B,$29,$39,$49,$5C,$6F,$7C,$7F
  3351.         dc.b    $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F
  3352.         dc.b    $7F,$7F,$7C,$6F,$5C,$49,$39,$29,$1B,$0D
  3353.         dc.b    $00,$F3,$E5,$D7,$C7,$B7,$A4,$91,$84,$81
  3354.         dc.b    $81,$81,$81,$81,$81,$81,$81,$81,$81,$81
  3355.         dc.b    $81,$81,$84,$91,$A4,$B7,$C7,$D7,$E5,$F3
  3356.  
  3357. crect        dc.b    $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7C,$6F,$5C
  3358.         dc.b    $49,$39,$29,$1B,$0D,$00,$F3,$E5,$D7,$C7
  3359.         dc.b    $B7,$A4,$91,$84,$81,$81,$81,$81,$81,$81
  3360.         dc.b    $81,$81,$81,$81,$81,$81,$81,$84,$91,$A4
  3361.         dc.b    $B7,$C7,$D7,$E5,$F3,$00,$0D,$1B,$29,$39
  3362.         dc.b    $49,$5C,$6F,$7C,$7F,$7F,$7F,$7F,$7F,$7F
  3363.  
  3364. ; Daten für Zifferblatt
  3365.  
  3366. dx1        dc.b    $FE,$02,$01,$FE,$01,$02,$FE,$FE,$FF,$FE,$FF,$FE
  3367. dy1        dc.b    $FC,$FF,$FE,$FE,$02,$01,$FE,$01,$02,$FE,$FE,$FF
  3368. dx2        dc.b    $04,$FE,$01,$04,$01,$FE,$04,$02,$FF,$04,$FF,$02
  3369. dy2        dc.b    $00,$03,$02,$00,$FE,$FD,$00,$FD,$FE,$00,$02,$03
  3370. dx3        dc.b    $00,$FE,$FD,$00,$FD,$FE,$00,$02,$03,$00,$03,$02
  3371. dy3        dc.b    $08,$FF,$02,$04,$FE,$01,$04,$01,$FE,$04,$02,$FF
  3372. dx4        dc.b    $FC,$02,$FF,$FC,$FF,$02,$FC,$FE,$01,$FC,$01,$FE
  3373. dy4        dc.b    $00,$FD,$FE,$00,$02,$03,$00,$03,$02,$00,$FE,$FD
  3374.  
  3375.         end
  3376.